Re: [hv]scale doesn't quite work the way I thought it would...
- From: Havoc Pennington <hp redhat com>
- To: skip pobox com (Skip Montanaro)
- Cc: Paul Davis <pbd op net>, gtk-list gnome org
- Subject: Re: [hv]scale doesn't quite work the way I thought it would...
- Date: 15 Sep 2001 10:17:10 -0400
Skip Montanaro <skip pobox com> writes:
> Paul> gtk_hscale_set_digits (GTK_SCALE(hsc), 0);
>
> Thanks, this did the trick. In fact, it solves both problems. It limits
> the display of the number of digits after the decimal point and rounds the
> value returned. No need to fiddle with the value-changed signal at all.
This is changed slightly in GTK 2, in that the range rounds values it
sets on the adjustment, but does not round values that others set on
the adjustment.
i.e. in GTK 1.2 if you do adjustment.set_value (3.5) and the
adjustment is in a range with digits of 0, the 3.5 will get rounded by
the range in a value_changed handler. In GTK 2 it will not be.
However the range itself will not set a value of 3.5, it will only set
rounded values.
The reason is that changing the value of the adjustment from
value_changed is a bit fishy; obviously if two handlers did that
differently, you would get an infinite loop. Also, if one handler did
it in a way that wasn't idempotent you'd get an infinite loop
(e.g. say you had a handler that added 1).
Another 2.0 feature is that you can have a custom routine to format
the text displayed for each value, which is sometimes useful.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]