HORIZSCROLLBAR
Jump to navigation
Jump to search
Description
- This command, along with VERTSCROLLBAR, controls the visibility of scrollbars in graphicbox controls. The range of scrolling can also be set with this command.
Syntax
- #handle.ext "horizscrollbar on/off [min max]"
Scrollbar Features
- Making visible. Scrollbars do NOT automatically show in a graphicbox, even if any graphic element is larger than the graphicbox size. To make scrollbars visible and active in graphicboxes, you must turn them on.
- Overriding _nsb Window Style. To get a graphics window with no sizing frame, one uses the command graphics_nf_nsb, which removes the scroll bars from the window. Use the command "horizscrollbar on" to show the scroll bar once again.
- Setting the Range. The default range of scrollbars is from 0 to a distance equal to the window width or height past the far edge of the largest graphic element in the graphicbox. You can control the scrolling range by including the min maxparameters in the scrollbar statement. Setting min max to 0 0 will make the scrollbar inactive - it will not scroll:
#handle.ext "horizscrollbar on 0 0"
- To enable the user to scroll from the left edge of the graphicbox to 50 pixels past the rightmost edge of any graphic elements, set min max to 0 50:
#handle.ext "horizscrollbar on 0 50"
Remember, you must flush any graphics to retain them if they are scrolled out of view.
Example
nomainwin WindowWidth=500 WindowHeight=400 graphicbox #1.gb 10, 10, 400, 300 open "Scrollbar Demo" for window as #1 #1 "trapclose [quit]" 'vertical scrollbar is visible but inactive with min max = 0 0 #1.gb "vertscrollbar on 0 0" 'horizontal scrollbar will scroll past end of the line 10 pixels #1.gb "horizscrollbar on 0 10" 'draw a line to visualize the scrollbar actions... #1.gb "down; size 3; line 10 50 500 50" wait [quit] close #1 end
Useful Procedures
' Place a useful function or sub using this keyword here