Re: [gtk-list] GtkOptionMenu - how to force active item "front"



Leslie M. Barstow III wrote:
> 
> I am working on learning Gtk+ the "easy" way (I am using Perl/Gtk), and
> have run into a problem.  Depending on the value in a config file, I need
> to set the proper GtkRadioMenuItem in a GtkOptionMenu active.  I can use
> set_state() or activate() to toggle the right item, but I would like to
> also have that item be the visible item when the menu is drawn, or, if
> necessary, after an update of some sort is performed.  C code is okay in
> responses - I'm just lazy (and Perl is better for the task).

void        gtk_option_menu_set_history     (GtkOptionMenu *option_menu,
guint index);

Although not intuitively obvious, the above function seems to do the job
just fine.

If you've added 3 choices to your option menu, and want to make the
second choice the currently selected one, just set the 'index' number to
2. (I can't remember off hand if indexes begin at 0 or 1, but i'm sure
with some experimentation will be obvious).

As for the perl equivalent, I've never used gtk-perl, sorry...

Hope that helps.

--
Lee.
http://atlas.cs.york.ac.uk/~lrpm100/



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