BBjWindow::getAvailableControlID

Description

In BBj 5.0 and higher, this BBjWindow method returns the next available control id on the window.

Syntax

Return Value

Method

int

getAvailableControlID()

Parameters

None.

Return Value

Returns the next available (unused) control ID on the window, starting at 100.

Remarks

None.

Example

rem 'Get next available control id for 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 common addWindow param values
X = 10
Y = 10
WIDTH = 200
HEIGHT = 200

rem 'Create a window with a title in the current context
TITLE$="BBj Window"

rem 'Set the current context
mySysGui!.setContext(0)
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

rem 'Create some controls
let id = myWindow!.getAvailableControlID()
let myEditBox1! = myWindow!.addEditBox(id,10,10,80,30,"Edit Box")

let id = myWindow!.getAvailableControlID()
let myEditBox2! = myWindow!.addEditBox(id,10,50,80,30,"Edit Box")

let id = myWindow!.getAvailableControlID()
let myButton! = myWindow!.addButton(id,10,90,80,30,"Button")

rem 'Retrieve all controls
let myVector! = myWindow!.getAllControls()
FOR I = 0 to myVector!.size()-1
    let control! = myVector!.get(I)
    PRINT control!.getText(),control!.getID()
NEXT I

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

See Also

BBjAPI

BBjControl

BBjWindow

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