Notices


Reply
Thread Tools
Posts: 8 | Thanked: 0 times | Joined on Oct 2010 @ malaysia
#1
I need something like the color selector on the calendar > setting
(to select the color of the event category)

i manage to implement something similar using
hildon.Button and when the user click on the button.. a dialog will open that display a list of image (image is another hildon.Button)

the problem is, when the image selected.. the image in the hildonButton previously (1st window) not updated.

how to update it like what happen on the calendars?

p/s: i am using pygtk
Attached Images
  

Last edited by paragasu; 2010-12-25 at 14:01.
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#2
When the button in the pick color dialog is clicked, you need to emit a signal. Previous window needs to have that signal connected to a function that changes/updates the color in that button.

Don't forget that the signal emitted must have the picked color into brackets.
 
Posts: 8 | Thanked: 0 times | Joined on Oct 2010 @ malaysia
#3
hi gionni88, thanks for the reply.

i did not understand what u mean, looking to the documentation, the only possible signal will be "pressed" & "released".

> Don't forget that the signal emitted must have the picked color into brackets.
what do you mean?
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#4
You have to use custom signals. I don't know how to do that in pygtk, I'll explain how I do with c++ and qt. For an example look here: http://zetcode.com/tutorials/pygtktutorial/signals/

Let's say the pick color dialog is a child of the 1st window, you have to declare a custom signal in the pick dialog .h file and implement it in this way:

when the button is clicked (signal clicked), the dialog window emits the signal colorPicked(int color) where color is a number to distingue the several colors.

In the parent window file you connect that signal with a custom function that set the color variable and recolor/reload the updated color icon like this:
connect(dialog, SIGNAL(colorPicked(int)), parentWindow, SLOT(setColor(int));
 

The Following User Says Thank You to gionni88 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 11:56.