Re: GtkAdjustment and GtkSpinButton question



-- Matthew Weier OPhinney <matthew-lists weierophinney net> wrote
(on Wednesday, 13 August 2003, 10:43 AM -0400):
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?

I've also tried constructing it as:

    my $spin = Gtk2::SpinButton->new_with_range($min, $max, $step);
    $spin->set_value($val);

But I'm still left with it starting at $min instead of $val.

-- 
Matthew Weier O'Phinney
http://weierophinney.net/matthew/



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