Re: [Fwd: Re: Gtk2::MenuItem get_label?]



On Sun, 2005-04-17 at 20:30 +0200, Martin Junius wrote:
Back to some Gtk2-Perl hacking after a longer break ...
There is still one problem, where I didn't get an answer yet, see below. 
I'd really appreciate a way to get to all the labels. Thanks.

Martin

...

So it seems I can only retrieve the label from menu items which are
*not* currently selected? Strange.

I didn't get the effect you describe with a standard menu bar created in
Glade - all the labels are available, whether the item is selected or
not (works for both radio button and checkbox menu items).

However then I noticed in your code you were calling get_menu whereas I
needed to call get_submenu.  After a bit of searching, I found that
get_menu is a method of the Gtk2::OptionMenu class.  So instead of using
a menubar for testing, I created a toolbar and added an OptionMenu item
to it.  This gave exactly the behaviour you describe.

I notice the OptionMenu widget is on the 'Deprecated' tab in Glade.  Is
there a reason you need to use this widget in particular?

I've attached a test script that uses the MenuBar widget and seems to
work.  Does it achieve the kind of effect you're after?

Regards
Grant

Attachment: menutest.pl
Description: Perl program



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