Re: I guess this is a newbie type question.

Brian Avis wrote:

I have a button like so.

$button = new Gtk::Button("Test");
$button->signal_connect("clicked", \&print_test($begin_pay_period, 
$YEAR, $days_in_year));

Try this:

  $button->signal_connect("clicked", \&print_test, $begin_pay_period, $YEAR, $days_in_year);

The way you wrote it, the print_test subroutine is called immediately, 
because you pass parameters to it (this is the old perl4 style 
subroutine call). A reference to the result of the subroutine call will
be passed to signal_connect, which is not what you want.

The code above passes the subroutine ref and your parameters seperately
as parameters to the signal_connect method. Then Gtk will give the 
parameters to your subroutine, when the signal handler is called.



Joern Reder - joern netcologne de

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