Re: accessing selected item from OptionMenu
- From: René Seindal <rene seindal dk>
- To: Chris Phillips <chris thirtythreeandathird net>
- Cc: muppet <scott asofyet org>, gtk-perl-list gnome org
- Subject: Re: accessing selected item from OptionMenu
- Date: Fri, 27 Jun 2003 20:15:08 +0200
On Fri, Jun 27, 2003 at 06:34:37PM +0100, Chris Phillips wrote:
you didn't mention whether you were using gtk-perl or gtk2-perl, so i've
answered for both.
sorry, gtk2 of course... thought you might have rememebered me from a few
days ago...
gtk+-2.x adds the incredibly useful gtk_option_menu_get_history function.
recall that gtk_option_menu_set_history has always been the way to set which
item in the menu is selected --- get_history tells you the index of the one
that is selected.
so, in gtk2-perl, that would be INTEGER = $optionmenu->get_history.
erm... ok... i'm already *using* set_history... i feel stupid - no suprise
there then. that is only the position though, not the label string or any
other data associated with the item.
You can get the menu of an optionmenu. I use this bit of code:
my $menu = $optionmenu->get_menu;
my $data = $menu->get_active->get_data('data') if ($menu);
get_active() gives you the menu item, and I set some user-data on it to
indicate what the item represents.
as for the ItemFactory use, I got as far as getings signals through the
entries, and finally gave up when I kept getting invalid path errors for
the accelgroup... nevermind.
thanks
chris
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
--
René Seindal (rene seindal dk) http://sights.seindal.dk/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]