Re: scale problem
- From: John Cupitt ng-london org uk
- To: chris roadfeldt com
- Cc: gtk-devel-list gnome org
- Subject: Re: scale problem
- Date: Mon, 18 Feb 2002 11:32:19 -0000
Chris Roadfeldt wrote:
> I am having an annoying problem with a couple of scale widgets. The
> code to create the scales is quite large, but it works. The core of the
> problem is the scale allows a value 1 larger than the adjustment max.
> The adjustment max I am setting is 2147483647, but when the scale is
> moved to the max, it returns 2147483648 as the adjustment value. This
> causes my app to do bad things. I can set the adjustment max to a lower
> value, but this seems like a hack. I would rather fix the problem
> itself. Does anyone have any ideas?
Hi Chris, could this just be the page_size thing in GtkAdjustment? I
know this bit me several times.
If your model is:
struct _MyScale {
... stuff
double from;
double to;
double value;
stuff ...
}
then to set up the adjustment from your model you need something like:
double range = myscale->to - myscale->from;
adj->page_size = range / 10;
adj->page_increment = range / 10;
adj->step_increment = range / 100;
adj->lower = myscale->from;
adj->upper = myscale->to + adj->page_size;
now adj->value will change in the range [myscale->from, myscale->to].
Hope I've not misunderstood.
John
==========================================================
Aelbert Cuyp 13 February - 12 May 2002
For information and tickets:
http://www.nationalgallery.org.uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]