Re: Getting the name of a button.
- From: Kenneth Swanson <kswanson watson wustl edu>
- To: GTK-perl-List <gtk-perl-list gnome org>
- Subject: Re: Getting the name of a button.
- Date: 26 Aug 2003 11:29:43 -0500
On Tue, 2003-08-26 at 10:43, muppet wrote:
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);
Unless I'm mistaken, you want this:
# fetch the button's contained child
$label = $button->child;
die "child isn't what i thought it was"
unless 'Gtk::Label' eq ref $label;
$label->set_text ($new_text);
(The bin method is ->child, and you want to make sure $label is a label)
-Ken
(Just another guy who hasn't/can't upgrade to Gtk2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]