BBjWindow::addProgressBar

Description

In BBj 3.00 and higher, this method adds a progress bar control to the BBjWindow.

Syntax

Return Value

Method

BBjProgressBar

addProgressBar(int ID, number x, number y, number w, number h)

BBjProgressBar

addProgressBar(int ID, number x, number y, number w, number h, int minimum, int maximum)

BBjProgressBar

addProgressBar(int ID, number x, number y, number w, number h, int orientation)

BBjProgressBar

addProgressBar(int ID, number x, number y, number w, number h, int orientation, int minimum, int maximum)

BBjProgressBar

addProgressBar(int ID)

BBjProgressBar

addProgressBar(int ID, int minimum, int maximum)

BBjProgressBar

addProgressBar(int ID, int orientation)

BBjProgressBar

addProgressBar(int ID, int orientation, int minimum, int maximum)

BBjProgressBar

addProgressBar()

Parameters

Variable

Description

ID

Specifies the Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

width

Width of the control in current units.

height

Height of the control in current units.

orientation

Use one of the following constants. By default, the orientation is HORIZONTAL.

HORIZONTAL

VERTICAL

minimum

Minimum value. The default minimum value is 0.

maximum

Maximum value. The default maximum value is 100.

Return Value

Returns the created BBjProgressBar object.

Remarks

If the ID parameter is not specified, a control ID is assigned dynamically using getAvailableControlID().

If the x, y, width, and height parameters are not specified, they're all initialized to 0. This is typically for use with DWC windows that dynamically arrange their contents (window creation flag $00100000$).

Example

rem 'Add a progress bar control to a window

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 '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

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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