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



Raul Dias wrote:

hi,

I am trying to get the label of a MenuItem in a Gtk::OptionMenu.

[...]
sub callback {
 my ($widget) = @_;
 print "undefined child!\n" unless defined $widget->child;
}

Hi,

I reckon that this should work - although I haven't tried it :)

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


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

When adding it to the callback.

Raul Dias



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