Signal handler args



Hi all,

Following a previous thread, I tried to connect a signal handler to
'button_press_event' and was delighted that it worked - however ...

In the event handler, 'print Dumper(\ _)' produces:
(I passed {'data'=>'test data'} to the data arg of signal_connect)
$VAR1 = [
          bless( do{\(my $o = 137040016)}, 'Gtk2::Button' ),
          bless( do{\(my $o = 137239944)}, 'Gtk2::Gdk::Event' ),
          {
            'data' => 'test data'
          }
        ];

Please can we have the args to the signal handlers delivered as:

  my ($widgetref, $dataref) = @_;

or for an event handler

  my ($widgetref, $dataref, $eventref) = @_;

At least this way, it is possible to write generic handlers that do
not need to know whether the handler is connected to a signal or an
event in order to work. It also makes it possible to auto-generate
simple signal handlers for programmers to edit (Glade-Perl-Two will 
do this so I have an interest :-)

I don't know if it is simple to translate the Gtk2::Gdk::Event into
an anonymous hash and pass that to the handler as Gtk-Perl does but 
IMO that is any easier thing to use and understand.

Regards, Dermot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]