Re: I guess this is a newbie type question.
- From: Brian Avis <brian avis searhc org>
- To: Joern Reder <joern netcologne de>
- Cc: gtk-perl-list gnome org
- Subject: Re: I guess this is a newbie type question.
- Date: Wed, 02 Jan 2002 08:14:10 -0900
Thanks, that did it.
Now for the next question. In the main part of the program I declare this.
my %spinner;
Then later on in a subroutine I do this.
$spinner{$hour_type}{$year}{$day} = new Gtk::SpinButton($adj, 0, 2);
As well as the various other attributes you can adjust on a spin button.
The problem is that later on in another sub-routine when I try to read my
spinbutton with this.
$spinner{$hour_type}{$year}{$print_day}->get_value_as_float();
It tells me that it can't call get_value_as_float with an undefined value
(or something close to that).
Any ideas on what I am screwing up now?
Joern Reder wrote:
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));
$button->show();
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.
Regards,
Joern
--
Brian Avis
SEARHC Medical Clinic
Juneau, AK 99801
(907) 463-4049
cd /pub
more beer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]