Description
In BBj 10.0 and higher, this method returns the labels from a BBjSlider control.
Syntax
Parameters
None.
Return Value
Returns a Java Map<Integer,String> structure, where each Integer key is the slider position of the corresponding String label.
Remarks
If custom labels are not defined, the slider generates labels corresponding to the integer values of the major ticks.
Example
rem 'Set and Get BBjSlider Labels
rem 'Obtain the instance of the BBjAPI object
let myAPI! = BBjAPI()
rem 'Open the SysGui device
SYSGUI = UNT
OPEN (SYSGUI) "X0"
rem 'Obtain the instance of the BBjSysGui object
let mySysGui! = myAPI!.getSysGui()
rem 'Set addWindow param values
X = 100
Y = 100
WIDTH = 200
HEIGHT = 300
TITLE$="BBjSlider"
rem 'Set the current context
mySysGui!.setContext(0)
rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)
rem 'Add a vertical slider on the window
mySlider! = myWindow!.addVerticalSlider(101,50,25,100,250,$0000$)
mySlider!.focus()
mySlider!.setMinimum(0)
mySlider!.setMaximum(3)
mySlider!.setPaintTicks(1)
mySlider!.setMajorTickSpacing(1)
mySlider!.setPaintLabels(1)
labels! = new java.util.TreeMap()
labels!.put(0,"Off")
labels!.put(1,"Small")
labels!.put(2,"Medium")
labels!.put(3,"Large")
print "Default labels: ",mySlider!.getLabels()
mySlider!.setLabels(labels!)
print " Custom labels: ",mySlider!.getLabels()
rem 'Register the CALLBACK routines
CALLBACK(ON_CONTROL_SCROLL,SLIDER_SCROLLED,mySysGui!.getContext(),mySlider!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
rem 'Process Events
process_events
rem 'Callback routine called when the slider is used to scroll
SLIDER_SCROLLED:
rem 'Get the new value of the slider
VAL = mySlider!.getValue()
MIN = mySlider!.getMinimum()
MAX = mySlider!.getMaximum()
return
rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release
|
See Also
BBjAPI
BBjSysGui
BBjControl
BBjWindow
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.