Re: Passing values to CodeRefs
- From: Emmanuele Bassi <ebassi gmail com>
- To: gtk-perl-list gnome org
- Subject: Re: Passing values to CodeRefs
- Date: Wed, 10 Jan 2007 18:23:22 +0000
hi;
On Wed, 2007-01-10 at 12:00 -0600, Nik Ogura wrote:
Whats the syntax for calling a coderef with arguments here?
this works: $widget->signal_connect(clicked => \&rankChanged);
this doesnt: $widget->signal_connect(clicked => \&rankChanged($arg));
$widget->signal_connect(clicked, \&rankChanged, $arg)
this works in Perl/Tk but not here:
$widget->signal_connect(clicked => [\&rankChanged, $arg1, $arg2]);
and this should be:
$widget->signal_connect(clicked => \&rankChanged, [ $arg1, $arg2 ]);
likewise: $widget->signal_connect(clicked => sub{});
this should work.
If this is in the POD, where? (so that I can find it myself next time)
yep, sure:
perldoc Glib::api
perldoc Glib::Object
perldoc Gtk2::api
while on the web you can find the (still unfinished) Gtk2-Perl tutorial
at:
http://devel.emmanuelebassi.net/gtk2-perl/tutorial/
(for instance, your question is answered in depth on the page about
signals:
http://devel.emmanuelebassi.net/gtk2-perl/tutorial/sec-TheoryOfSignalsAndCallbacks.html)
and the Gtk2-Perl FAQ on the GNOME wiki:
http://live.gnome.org/GTK2-Perl/FrequentlyAskedQuestions
ciao,
Emmanuele.
--
Emmanuele Bassi, E: ebassi gmail com
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]