BBjWindow::getControl

Description

Returns a BBjControl object in the BBjWindow.

Syntax

Return Value

Method

BBjControl

getControl(int ID)

BBjControl

getControl(string name)

Parameters

Variable

Description

ID

Specifies the ID of the control. A value of 0 may be used to get information about a context's window or dialog rather than an individual control or child window (as defined in the CTRL() function).

name

In BBj 8.00 and higher, specifies the name of the control.

Return Value

Returns a BBjControl object.

Remarks

The getControl(string name) version throws an exception if there are no controls, or if there is more than one control, with the specified name.

Example

rem 'Get a control from 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 'Add a button on the window using mnemonics
PRINT (SYSGUI)'BUTTON'(101,50,100,90,30,"Red",$$)

rem 'Get the button
myRedButton! = myWindow!.getControl(101)

rem 'Create the BBjColor Object using colorNum constant
myColorRed! = mySysGui!.makeColor(mySysGui!.RED)

rem 'Set the button colors to RED
myRedButton!.setBackColor(myColorRed!)

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

BBjWindow

BBjControl Methods

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