BBjSlider::getOrientation

Description

In BBj 12.0 and higher, this method returns the orientation of the BBjSlider control.

Syntax

Return Value

Method

int

getOrientation()

Parameters

None.

Return Value

Returns the orientation of the BBjSlider (0 = HORIZONTAL, 1 = VERTICAL).

Remarks

For a listing of control type constants, see Constants in BBjControl.

Example

rem ' slider.txt

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(100,100,520,240,"Horizontal BBjSlider",$2009008f$)
window!.setCallback(sysgui!.ON_CLOSE,"eoj")
slider! = window!.addHorizontalSlider(100,10,10,500,50)
print "getOrientation()",slider!.getOrientation()," ",
switch slider!.getOrientation()
    case slider!.HORIZONTAL; print "HORIZONTAL"; break
    case slider!.VERTICAL; print "VERTICAL"; break
    default; print "UNKNOWN"; break
swend
slider!.setBackColor(sysgui!.makeColor(255,255,232))
slider!.setCallback(sysgui!.ON_CONTROL_SCROLL,"scroll")
slider!.setCallback(slider!.ON_GAINED_FOCUS,"event")
slider!.setCallback(slider!.ON_LOST_FOCUS,"event")
slider!.setCallback(slider!.ON_MOUSE_ENTER,"event")
slider!.setCallback(slider!.ON_MOUSE_EXIT,"event")
slider!.setCallback(slider!.ON_POPUP_REQUEST,"event")
slider!.setCallback(slider!.ON_RIGHT_MOUSE_DOWN,"event")
popup! = sysgui!.addPopupMenu()
item1! = popup!.addMenuItem(-1,"Popup Item 1")
item2! = popup!.addMenuItem(-1,"Popup Item 2")
item3! = popup!.addMenuItem(-1,"Popup Item 3")
slider!.setPopupMenu(popup!)
window!.addStaticText(201,5,105,60,25,"Minimum:",$8000$)
minimum = slider!.getMinimum()
minimum! = window!.addInputN(101,70,100,60,25,$$,"-###,##0",$$,minimum,minimum)
minimum!.setCallback(sysgui!.ON_EDIT_MODIFY,"minimum")
window!.addStaticText(202,5,135,60,25,"Maximum:",$8000$)
maximum = slider!.getMaximum()
maximum! = window!.addInputN(102,70,130,60,25,$$,"-###,##0",$$,maximum,maximum)
maximum!.setCallback(sysgui!.ON_EDIT_MODIFY,"maximum")
window!.addStaticText(203,5,165,60,25,"Value:",$8000$)
value = slider!.getValue()
value! = window!.addInputN(103,70,160,60,25,$$,"###,##0",$$,0,value)
value!.setCallback(sysgui!.ON_EDIT_MODIFY,"value")
label! = window!.addStaticText(204,130,105,125,25,"Tick Spacing",$8000$)
font! = label!.getFont()
font! = sysgui!.makeFont(font!.getName(),font!.getSize()+2,font!.BOLD)
label!.setFont(font!)
window!.addStaticText(205,130,135,60,25,"Major:",$8000$)
major = 20
major! = window!.addInputN(104,195,130,60,25,$$,"-###,##0",$$,major,major)
major!.setCallback(sysgui!.ON_EDIT_MODIFY,"major")
slider!.setMajorTickSpacing(major)
window!.addStaticText(206,130,165,60,25,"Minor:",$8000$)
minor = 5
minor! = window!.addInputN(105,195,160,60,25,$$,"-###,##0",$$,minor,minor)
minor!.setCallback(sysgui!.ON_EDIT_MODIFY,"minor")
slider!.setMinorTickSpacing(minor)
labels! = window!.addCheckBox(106,270,100,120,25,"Paint Labels",$0004$)
labels!.setCallback(sysgui!.ON_CHECK_ON,"labels_on")
labels!.setCallback(sysgui!.ON_CHECK_OFF,"labels_off")
slider!.setPaintLabels(labels!.isSelected())
ticks! = window!.addCheckBox(107,270,130,120,25,"Paint Ticks",$0004$)
ticks!.setCallback(sysgui!.ON_CHECK_ON,"ticks_on")
ticks!.setCallback(sysgui!.ON_CHECK_OFF,"ticks_off")
slider!.setPaintTicks(ticks!.isSelected())
snap! = window!.addCheckBox(108,270,160,120,25,"Snap To Ticks",$0004$)
snap!.setCallback(sysgui!.ON_CHECK_ON,"snap_on")
snap!.setCallback(sysgui!.ON_CHECK_OFF,"snap_off")
slider!.setSnapToTicks(snap!.isSelected())
height = slider!.getHeight()
height! = window!.addInputNSpinner(109,390,100,120,25,1,99)
height!.setText(str(height))
height!.setCallback(sysgui!.ON_SPIN,"height")
labels! = window!.addCheckBox(110,390,130,120,25,"Custom Labels")
labels!.setCallback(sysgui!.ON_CHECK_ON,"custom_labels")
labels!.setCallback(sysgui!.ON_CHECK_OFF,"default_labels")
inverted! = window!.addCheckBox(111,390,160,120,25,"Inverted")
inverted!.setCallback(sysgui!.ON_CHECK_ON,"inverted_on")
inverted!.setCallback(sysgui!.ON_CHECK_OFF,"inverted_off")
slider!.setInverted(inverted!.isSelected())
enabled! = window!.addCheckBox(112,390,190,120,25,"Enabled",$0004$)
enabled!.setCallback(enabled!.ON_CHECK_ON,"setEnabled")
enabled!.setCallback(enabled!.ON_CHECK_OFF,"setEnabled")
statusbar! = window!.addStatusBar(99,$$)
vector! = bbjapi().makeVector()
vector!.add(530)
statusbar!.setSegments(vector!)
statusbar!.setTextAt(0,"Labels: "+slider!.getLabels().toString())
dim event$:tmpl(sysgui)

process_events

eoj:
release

scroll:
    event! = sysgui!.getLastEvent()
    event$ = sysgui!.getLastEventString()
    e$ = sysgui!.getLastEvent().toString(), e$ = e$(1,pos("@"=e$)-1)
    print e$," code=",event.code$," context=",str(event.context),
    print " id=",str(event.id)," flags=",str(event.flags),
    print " x=",str(event.x)," y=",str(event.y),
    print " pos=",str(event!.getPosition())," adj? ",event!.isAdjusting()
    value = event!.getPosition()
    value!.setValue(value)
return

minimum:
    n = minimum!.getValue()
    if (n<>minimum) then
        slider!.setMinimum(n)
        minimum = n
        value!.setValue(slider!.getValue())
    endif
return

maximum:
    n = maximum!.getValue()
    if (n<>maximum) then
        slider!.setMaximum(n)
        maximum = n
        value!.setValue(slider!.getValue())
    endif
return

value:
    slider!.setValue(value!.getValue())
return

major:
    n = major!.getValue()
    if (n<>major) then
        slider!.setMajorTickSpacing(n)
        major = n
        value!.setValue(slider!.getValue())
        statusbar!.setTextAt(0,"Labels: "+slider!.getLabels().toString())
    endif
return

minor:
    n = minor!.getValue()
    if (n<>minor) then
        slider!.setMinorTickSpacing(n)
        minor = n
        value!.setValue(slider!.getValue())
        statusbar!.setTextAt(0,"Labels: "+slider!.getLabels().toString())
    endif
return

labels_on:
    slider!.setPaintLabels(1)
return

labels_off:
    slider!.setPaintLabels(0)
return

ticks_on:
    slider!.setPaintTicks(1)
return

ticks_off:
    slider!.setPaintTicks(0)
return

snap_on:
    slider!.setSnapToTicks(1)
return

snap_off:
    slider!.setSnapToTicks(0)
return

custom_labels:
    labels! = new java.util.TreeMap()
    n = rnd(10)
    for i = 1 to n
        labels!.put(rnd(100),chr(rnd(26)+asc("A")))
    next i
    slider!.setLabels(labels!)
    statusbar!.setTextAt(0,"Labels: "+slider!.getLabels().toString())
return

default_labels:
    labels! = new java.util.TreeMap()
    slider!.setLabels(labels!)
    statusbar!.setTextAt(0,"Labels: "+slider!.getLabels().toString())
return

inverted_on:
    slider!.setInverted(1)
return

inverted_off:
    slider!.setInverted(0)
return

setEnabled:
    slider!.setEnabled(enabled!.isSelected())
return

event:
    event! = sysgui!.getLastEvent()
    event$ = event!.toString(), event$ = event$(1,pos("@"=event$)-1)
    control! = event!.getControl()
    control$ = control!.toString(), control$ = control$(1,pos("@"=control$)-1)
    print control$," ",event$
return

height:
    event! = sysgui!.getLastEvent()
    height = num(event!.getText())
    slider!.setSize(500,height)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.