Re: gtk-gtk2 migration problems...



Quoting Bruno Boettcher <bboett bboett dyndns org>:
<snip>
since a nice guy finally made an adaptation of Gtk2 for POE i am
trying to migrate my progs to use Gtk2.... and have several
problems...
</snip>
<snip>
  ***   Usage: signal_connect(instance, detailed_signal, callback,
      data=NULL) at ./gtk2GUI.pl line 748.

</snip>
<snip>
  $button->signal_connect( 'clicked', \&delseries,
      $line->{"name"},$kernel);
</snip>

If you match up the args you see that

instance        = $button
detailed_signal = 'clicked'
callback        = \&delseries
data            = $line->{"name"}
                = $kernel

There is no parameter for $kernel to be placed in.  This is a change from
Gtk-Perl where the fourth arg was a valist.  To get around this you must either

1.  use an array ref and change delseries to accept it:
$button->signal_connect(
    'clicked',
    \&delseries,
    [
        $line->{"name"},
        $kernel
    ]
);
2.  use an anonymous function instead:
$button->->signal_connect(
    'clicked'
    sub {
        delseries(@_, $line->{"name"}, $kernel);
    }
);

I have always used the anonymous sub method (mainly for the closure aspect). 



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