Scrollbar 'min' parameter cannot be used
Jump to navigation
Jump to search
Description
The HORIZSCROLLBAR and VERTSCROLLBAR commands, for use in a Graphics Window or a GRAPHICBOX, take optional parameters controlling the minimum and maximum values of the scroll range. However if the min parameter is specified as any non-zero value the graphics do not scroll correctly.
Example code to demonstrate the bug.
nomainwin
WindowWidth = 400
WindowHeight = 600
graphicbox #demo.gb, 20, 20, 350, 500
open "Graphics Glitch Demo" for window as #demo
#demo "trapclose [quit]"
#demo.gb "vertscrollbar on 100 1500" ' note non-zero min value
#demo.gb "horizscrollbar on 100 2250" ' note non-zero min value
#demo.gb "down; color black; backcolor white"
#demo.gb "place 100 100; boxfilled 2600 2000"
for x = 120 to 2520 step 100
#demo.gb "place ";x;" 120"
#demo.gb "\";x
#demo.gb "place ";x + 15;" 150"
#demo.gb "circle 25"
next x
for y = 120 to 1920 step 100
#demo.gb "place 120 ";y
#demo.gb "\";y
#demo.gb "place 135 ";y + 30
#demo.gb "circle 25"
next y
#demo.gb "flush"
wait
[quit]
close #demo
end
Example code to work around the bug.
There is no known workaround which allows the min parameter to be used, so the only solution is to set that parameter to zero and offset all the graphics coordinates to compensate (here 100 has been subtracted from all the coordinates):
nomainwin
WindowWidth = 400
WindowHeight = 600
graphicbox #demo.gb, 20, 20, 350, 500
open "Graphics Glitch Demo" for window as #demo
#demo "trapclose [quit]"
#demo.gb "vertscrollbar on 0 1400" ' note zero min value
#demo.gb "horizscrollbar on 0 2150" ' note zero min value
#demo.gb "down; color black; backcolor white"
#demo.gb "place 0 0; boxfilled 2500 1900"
for x = 20 to 2420 step 100
#demo.gb "place ";x;" 20"
#demo.gb "\";x
#demo.gb "place ";x + 15;" 50"
#demo.gb "circle 25"
next x
for y = 20 to 1820 step 100
#demo.gb "place 20 ";y
#demo.gb "\";y
#demo.gb "place 35 ";y + 30
#demo.gb "circle 25"
next y
#demo.gb "flush"
wait
[quit]
close #demo
end