HTBasic Help
×
Menu
Index

ON KNOB

Defines an event branch for when the KNOB is turned.
 
 ON KNOB seconds [,priority] action
 
Usage:
ON KNOB 1 GOTO 500
ON KNOB Seconds,Priority Call Sub
ON KNOB 1/2,4 GOSUB Label
 
Example:           ON KNOB.BAS
 
Description:
Note: The KNOB keyword is for compatibility with HP Workstation BASIC even though on modern computers it is actually a mouse.
 
ON KNOB specifies the time interval in seconds for which movement of the KNOB is sampled. Nothing happens, however, until the first time the KNOB is moved after the ON KNOB statement has been executed. Once initial movement of the KNOB is detected, a timer begins for the specified interval. When the interval has expired, KNOBX and KNOBY are set to the distance the KNOB moved during the interval. A KNOB event is then generated. The value of seconds can range from 0.01 to 2.55 but is rounded to the timing resolution of the computer.
 
The KNOBX and KNOBY functions are read to determine the number of increments the KNOB has been moved in the x and the y directions during the interval.
 
Executing a new ON KNOB while another ON KNOB is still in effect overrides the previous ON KNOBdefinition. If the ON KNOB is executed in a different program context, the original ON KNOB definition is restored when control returns to the calling context.
 
ON KNOB is canceled by OFF KNOB and disabled by DISABLE. A SUBEXIT, SUBEND, or RETURN from the defining subprogram also cancels it.
 
 
More information about ON KNOB can be found under the "Common Information" heading of the ON CYCLE manual entry.
See Also: