[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Some questions about func_data things.
- From: Chas Owens <alas widomaker com>
- To: gtk-perl-list gnome org
- Subject: Re: Some questions about func_data things.
- Date: Wed, 23 Jul 2003 14:22:07 -0400 (EDT)
Quoting Christian Hamar <krics linuxforum hu>:
> hi there.
>
> So i create a thing like this :
>
> $gh = "first";
> $button = new Gtk2::Button("something");
> $button->signal_connect('clicked' => \&do, $gh);
>
> sub do {
> my ($tmp) = @_;
> print "tmp - $tmp\n";
> }
>
> So. I don't know. Is this the right way to "apply" a func_data thing to
> signal_connect ? If this is the right way then my question:
> When the script running then i got this:
> tmp - HASH(0x34252525) or something else hash value. How can i catch
> the $gh value that i specified for func_data ???
>
> A little example plz. many thx.
>
> Best regards: Christian Hamar alias kRiX
You need to say
my ($button, $tmp) = @_;
The first argument is always the widget responsible for the event. Personally I
always say
$button->signal_connect(
'clicked' => sub {
do($gh)
}
);
since I can't remember where user data winds up when there are other arguments.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]