Re: GTK OPTION MENU

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

 



Le mardi 10 mai 2005 Ã 18:27 +0530, Mohit Kumar a Ãcrit :
> Thanks for a prompt reply Jean. In the case of a combo box, how should
> I be going about it then?

You'll find the doc at:
http://developer.gnome.org/doc/API/2.0/gtk/GtkComboBox.html

To add a string, use gtk_combo_box_append_text or
gtk_combo_box_prepend_text

To get the active selection:
gint gtk_combo_box_get_active        (GtkComboBox *combo_box);

and to restore the selection:
void        gtk_combo_box_set_active        (GtkComboBox *combo_box,
                                             gint index_);

> Thanks,
> Mohit
> 
> On 5/10/05, Jean BrÃfort <jean.brefort@xxxxxxxxxxxxxx> wrote:
> > Le mardi 10 mai 2005 Ã 17:31 +0530, Mohit Kumar a Ãcrit :
> > > Hi All,
> > >
> > > This question is pretty trivial, but I have been unable to find a
> > > solution to this and hence I am posting it here, hoping to get a
> > > solution frmo anyone of you.
> > >
> > > The scenario is this, I have a list of Names to be displayed in the
> > > GTK OPTION MENU. Now, the list of names is static. When the user
> > > re-opens the dialog, I want the OPTION MENU to show the last selected
> > > name, instead of the first name in the list. I am storing the name in
> > > some structure.
> > >
> > > Is there any way to do it? Or i need to draw the OPTION MENU with the
> > > selected name as the first list member( I want to avoid this because
> > > they are in aphabetical order).
> > >
> > > For eg. Say the names are
> > > Albert<-----
> > > Charlie
> > > John
> > > Nathan
> > >
> > > And the user selects John, then when he reopens the dialog he should see
> > >
> > > Albert
> > > Charlie
> > > John<------
> > > Nathan
> > >
> > > In between the 2 calls, the windows is destroyed.
> > >
> > > Any help is highly appreciated.
> > 
> > You can use gtk_option_menu_set_history. But GtkOptionMenu is deprecated
> > and you should consider to use GtkComboBox instead.
> > 
> >
> 

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux