Re: Another silly newbie question
- From: "Ross McFarland" <rwmcfa1 neces com>
- To: "Fred. Oger" <oger sia ucl ac be>
- Cc: gtk-perl-list gnome org
- Subject: Re: Another silly newbie question
- Date: Thu, 14 Aug 2003 15:28:42 -0400 (EDT)
Fred. Oger said:
Hello everyone,
Could someone tell me how I could pass several args to my callback
function ?
$okbutton->signal_connect('clicked',\&ValidateLogin,$fieldUid,$fieldPwd);
you can pass them as an array reference (or hash reference etc)
$okbutton->signal_connect( clicked => \&ValidateLogin,
[ $fieldUid, $fieldPwd ]);
sub ValidateLogin
{
my $btn = shift;
my $udata = shift;
# $udata->[0] is $filedUid
# $udata->[1] is $filedPwd
}
my $udata = shift could be changed to my @udata = @{shift} and then $udata[0],
$udata[1] etc. much the same technique can be used for a hash reference.
It works perfectly with gtk1.2 but it's not accepted in Gtk2 ?
that was a design decision (for various reasons i don't remember all of now)
and since the solution is really simple (as above) it was deiced to following
the c bindings.
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]