Re: Getting the name of a button.



Eric Depagne said:
I would like to know if it is possible to get the label of the button on which
one clicks and assign it to let say $Name.

a button is a container, and when you create a button with new_with_label
(which is what Gtk::Button->new (string) does for you), the container has one
child, a GtkLabel.

try this (danger, will robinson, untested code!):

   # fetch the button's contained child
   $label = $button->get_child; # may be ->child, i don't remember for sure
   die "child isn't what i thought it was"
        unless 'Gtk::Label' eq ref $button;
   $label->set_text ($new_text);


-- 
muppet <scott at asofyet dot org>



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