Re: GtkAdjustment and GtkSpinButton question



-- muppet <scott asofyet org> wrote
(on Wednesday, 13 August 2003, 11:25 PM -0400):

On Wednesday, August 13, 2003, at 07:56  PM, Matthew Weier OPhinney 
wrote:

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:
<snip>
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.

i can't reproduce your problem unless the value i try to set is outside 
the range of min and max.

this test program:
<snip>
prints out

 25
 after set_value

so it sets the new value before the widget is shown (as expected, 
because an adjustment doesn't need to be displayed to change its value).

if i supply 5 to set_value instead of 25, the number doesn't print out, 
as though the callback doesn't run, and the value is set to 10, which 
is the minval.

you set up print statements to see that the correct values were getting 
in --- where were they?  what kinds of values were they?

Okay, figured out the problem. In my examples, you may have noticed I
was using the form "$option->{int_value}" to place the value; as it
turned out, this wasn't set -- I'd forgotten that I'd decided *not* to
use that attribute (it's a leftover from my python->perl conversion).
The print statements I was using were using the correct accesor
("$option->{value}"), and so, of course, showed the proper value.

When I changed what value was being set for the spin button, it worked
fine. (I had a similar issue going on with the toggle button that I
hadn't reported; same fix.)

Thanks for bearing with me, guys -- in the end, you pointed me in the
right direction!

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



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