Re: Problems getting the child of a Gtk::OptionMenu

On 10/29/01 Raul Dias wrote:
I am trying to get the label of a MenuItem in a Gtk::OptionMenu.
I reckon that this should work - although I haven't tried it :)

my $selected_string = ($widget->get_active->children)[0]->get;

"Can't call method "get" on an undefined value"

When adding it to the callback.

If I remember correctly, when a MenuItem in the OptionMenu gets
activated, its child is reparented to the OptionMenu, so you should be
able to access it with $optionmenu->child. The child is usaually a
Gtk::Label, you may want to use $child->get() to retrieve the text.
Or you may use a closure as the 'activate' signal handler.


lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better

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