Hi Mattia,
What would be the advantage after this change?
I often need to use
EVT_BUTTON( $self, $button, sub { $_[0]->do_foo( $_[1] ) } );
...just because I need to pass some more parameters to the do_foo
subroutine/method.
Would it be easier to pass parameters from now on somehow?
If it would be possible, I think it could be very helpful if we could use
something like:
EVT_BUTTON($self, $button, \&do_it, $parameter1, $parameter2);
and all the parameters after the subroutine reference to be added as as
parameters to that subroutine when calling it.
Thanks.
Octavian
----- Original Message -----
From: "Mattia Barbon" <[EMAIL PROTECTED]>
To: "wxperlusers" <wxperl-users@perl.org>
Sent: Sunday, August 31, 2008 2:14 PM
Subject: Binding events to methods
Hi,
I just checked in a change I planned to do since forever (and
that took 6 lines of code...) that allows binding an event to a
method instead to a subroutine/code reference. As an example
EVT_BUTTON( $self, $button, 'do_foo' );
will try to call do_foo as a method; it is more or less
equivalent to
EVT_BUTTON( $self, $button, sub { $_[0]->do_foo( $_[1] ) } );
Regards,
Mattia