After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 61743 - HScale/VScale label display always one step behind
HScale/VScale label display always one step behind
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other other
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 66772 72220 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2001-10-04 16:25 UTC by Skip Montanaro
Modified: 2011-02-04 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
C example demonstrating broken number display in HScale (861 bytes, text/plain)
2001-10-18 16:33 UTC, Skip Montanaro
  Details
created a patch to fix it (1.21 KB, patch)
2002-02-15 13:04 UTC, Satyajit Kanungo
none Details | Review

Description Skip Montanaro 2001-10-04 16:25:18 UTC
The display of a scale widget's label seems to always be one step behind the position of the slider itself.  It's not until you let go of the mouse button that the label jumps to position.

This is most easily seen if you create a rather wide or tall scale widget and set the number of digits to display to 0.  Here's a simple Python example that demonstrates the problem:

import gtk

window = gtk.Window()
window.connect("destroy", gtk.mainquit)

adj = gtk.Adjustment(10, 0, 20, 1, 1, 1)
s = gtk.HScale(adj)
s.set_digits(0)
window.add(s)

window.show_all()

gtk.mainloop()
Comment 1 Owen Taylor 2001-10-18 15:51:46 UTC
We'd really appreciate test cases in C :-). Test cases
in Python aren't conducive to debugging in a debugger,
and not everyone working on GTK+ will have the python
bindings, python 2.2, automake-1.5, etc.
Comment 2 Skip Montanaro 2001-10-18 16:33:32 UTC
Created attachment 5860 [details]
C example demonstrating broken number display in HScale
Comment 3 Skip Montanaro 2001-10-18 16:36:14 UTC
I attached a C example that demonstrates the problem.  It's my first
Gtk program written in C.  If you'd  like a tutorial on debugging Gtk
via gdb (works just fine for C code called from Python as well), let
me know. ;-)
Comment 4 Owen Taylor 2001-12-12 04:41:45 UTC
*** Bug 66772 has been marked as a duplicate of this bug. ***
Comment 5 Satyajit Kanungo 2002-02-15 13:04:40 UTC
Created attachment 6736 [details] [review]
created a patch to fix it
Comment 6 Satyajit Kanungo 2002-02-15 13:08:13 UTC
I think in gtkhscale and gtkvscale expose function (gtk_hscale_expose)
the expose event for the parent class (parent_class->expose_event)
can be called at the start of the method insted of at the end.  
 
 
Comment 7 Havoc Pennington 2002-02-21 21:51:16 UTC
I believe this patch is correct. The parent class expose handler needs
to run so that the geometry gets calculated before the vscale/hscale
handler runs.
Comment 8 Matthias Clasen 2002-02-22 14:18:57 UTC
*** Bug 72245 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2002-02-22 14:23:04 UTC
*** Bug 72220 has been marked as a duplicate of this bug. ***
Comment 10 Owen Taylor 2002-02-27 00:37:36 UTC
Applied with:

 - Comment about the strange side effect
 - Chain up first outside of the 'if (scale->draw_value)'
   conditional.
 - Fixes to conform GTK+ indentation style.

Tue Feb 26 19:32:42 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtk[hv]vscale.c (gtk_[hv]scale_expose): Chain
	up before drawing the scale values so that the number
	is drawn in the right place instead of one step 
	back. (#61743, patch from Satyajit Kanungo)