BBjProgressBar::getOrientation

Description

In BBj 3.0 and higher, this method returns the orientation of the BBjProgressBar control.

Syntax

Return Value

Method

int

getOrientation()

Parameters

None.

Return Value

Returns one of the following orientation constants:

HORIZONTAL

VERTICAL

 

Remarks

By default, the orientation is set to HORIZONTAL.

Example

REM Get the orientation of the progress bar

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=300
HEIGHT=100
TITLE$="BBj Window"

REM Set the current context
mySysGui!.setContext(0)

REM Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

REM Add some buttons to the window
startButton! = myWindow!.addButton(1,5,10,90,30,"Start")
stopButton! = myWindow!.addButton(2,105,10,90,30,"Stop",$0001$)
resetButton! = myWindow!.addButton(3,205,10,90,30,"Reset")

REM Add a progress bar control to the window
myProgressBar! = myWindow!.addProgressBar(101,5,50,290,30)

REM Get the orientation of the progress bar
SWITCH myProgressBar!.getOrientation()
          CASE myProgressBar!.HORIZONTAL
                 TEMP = MSGBOX("Horizontal progress bar")
                 BREAK
          CASE myProgressBar!.VERTICAL
                 TEMP = MSGBOX("Vertical progress bar")
                 BREAK
          DEFAULT:
                 TEMP = MSGBOX("Unknown progress bar alignment")
                 BREAK
SWEND

REM Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_BUTTON_PUSH,doStart,mySysGui!.getContext(),startButton!.getID())
CALLBACK(ON_BUTTON_PUSH,doStop,mySysGui!.getContext(),stopButton!.getID())
CALLBACK(ON_BUTTON_PUSH,doReset,mySysGui!.getContext(),resetButton!.getID())

REM Process Events
PROCESS_EVENTS

doStart:
startButton!.setEnabled(0)
myAPI!.createTimer("",0.1,"progress")
stopButton!.setEnabled(1)
return

doStop:
stopButton!.setEnabled(0)
myAPI!.removeTimer("")
startButton!.setEnabled(1)
return

progress:
myProgressBar!.setValue(myProgressBar!.getValue()+1)
if myProgressBar!.getValue() >= myProgressBar!.getMaximum()
         gosub doStop
endif
return

doReset:
myProgressBar!.setValue(myProgressBar!.getMinimum())
return

REM Callback routine called when the user closes the application window
APP_CLOSE:
RELEASE
RETURN

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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