Re: GtkAdjustment and GtkSpinButton question



Matthew Weier OPhinney said:
I'm trying to create a GtkSpinButton, and having a slight problem.

It requires a GtkAdjustment, a climb rate, and the number of decimal
places to display. No problem; it displays correctly, and climbs (or
descends) at the proper rate.

The problem is with the GtkAdjustment -- I can't get it to accept the
proper initial value.

I'm constructing it like so:

my $spin = Gtk2::SpinButton->new(
    Gtk2::Adjustment->new($val, $min, $max, $step, $step + 3, $max - $min),
    1,
    0
);

where $val is my initial value, $min is my minimum value, and $step is
the increment I wish to use. (I found I needed to use the last two
values as well, even though GtkSpinButton doesn't use them; otherwise
GtkAdjustment threw an error.)

Am I constructing the widget correctly? Can I set the initial value some
other way?

--
Matthew Weier O'Phinney
http://weierophinney.net/matthew/
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


the GtkSpinButton page has two examples in the description section that seem
to agree with how you're doing things.
    http://developer.gnome.org/doc/API/2.0/gtk/GtkSpinButton.html

i've got some code that uses a spin button as you are that seems to work. i
know this sounds stupid, but verify that the values you're passing in for
min/max/val are correct. failing that i guess i'd need some example code that
exhibits the problem to help any more.

-rm



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