Re: gtk signal



I am writing a dialog containing hour:minute:second. It's easy to display them
seperately in
12-Hour time or 24-Hour time.

Now I added a combo box to select 12 or 24 -Hour time just like the 5-selection 
in
calendar in gtk+ tutriol.
So you may tell me how to connect the "changed" signal with the different kind o
f
diaplaying.

In this case you have only two states, 12 or 24, so I would
suggest you use something simpler than a combo box, actually
I would suggest a simple toggle button. Moreover, with a
combo box you allow the user to choose something different,
say 10, so you would have to check for errors, etc... not
a good ideia. If you don't like the toggle button, at least
use an option menu. All these solutions use about the same
space in your dialog. If space is not a problem, then you
might consider also 2 radio buttons. Go for simplicity...

Anyway, if you really want to use a combo box, save it with:
gtk_object_set_data (GTK_OBJECT (dialog), "combo_box", combo);

and then in your callback, retrieve the information with:
combo = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "combo_box");
name = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry));

The chosen time style is now described by the string pointed 
by name, you just have to handle it, with strcmp or wathever,

If you choose one the other solutions above, you can still use 
the same set_data/get_data method, with minor variations.
The address of dialog, the dialog window, must be known
in the callback, you can pass it inside the data structure pointer.

Carlos




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]