Re: GtkAdjustment and GtkSpinButton question
- From: Matthew Weier OPhinney <matthew-lists weierophinney net>
- To: gtk-perl-list gnome org
- Subject: Re: GtkAdjustment and GtkSpinButton question
- Date: Wed, 13 Aug 2003 19:56:45 -0400
-- Ross McFarland <rwmcfa1 neces com> wrote
(on Wednesday, 13 August 2003, 12:36 PM -0400):
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.
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'd been reading that when I constructed it originally. I've also tried
another method, as posted to the list. Neither worked...
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.
Here's what I've got going. I'm pulling data from an XML file using
XML::DOM. To ensure that I'm getting integers to pass to
Gtk2::SpinButton's max and min values, I'm using something like:
my $min = int($node->getAttribute('min'));
my $max = int($node->getAttribute('max'));
my $val = $option->{int_value}; # this is already an integer
my $step = $node->getAttribute('step');
($step) ? $step = int($step) : $step = 1;
my $spin = Gtk2:SpinButton->new_with_range($min, $max, $step);
$spin->set_value($val);
And that's not working. I've even setup some print statements to make
sure that it's getting proper values (it is), but the value isn't being
set.
Oddly enough, if I set the value *later*, i.e. after it's been
manipulated, it *will* take. Go figure.
Any ideas?
(I should probably upgrade to 0.92 to see if the error still happens
there... I'm on 0.90 -- unless no changes have been made to this
portion...)
--
Matthew Weier O'Phinney
http://weierophinney.net/matthew/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]