Description
In BBj 4.00 and higher, this method binds a pre-existing popup menu to
the BBjControl.
Syntax
Return Value |
Method |
void |
setPopupMenu(BBjPopupMenu popupMenu!) |
Parameters
Parameter |
Description |
popupMenu! |
Specifies
the popup menu to be bound to this control. |
Return Value
None.
Remarks
A single popup menu can be assigned to any number of controls at the
same time.
When the owner of the parameter does not match the object on which the
methods is being called, an !ERROR=208
Multi Thread results. See Accessing
Objects From Different Interpreters.
Example
rem 'Create a popup menu and assign it to a control
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 = 200
HEIGHT = 100
TITLE$="BBj Window"
rem 'Set the current context
mySysGui!.setContext(0)
rem 'Create a window with a title in the current context
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)
rem 'Create a button
myButton! = myWindow!.addButton(1,55,35,90,30,"OK")
rem 'Create a popup menu and associate it with the button
myPopupMenu! = mySysGui!.addPopupMenu()
myButton!.setPopupMenu(myPopupMenu!)
rem 'Add menu items to the popup menu
myItem1! = myPopupMenu!.addMenuItem(-201,"Item 1")
myItem2! = myPopupMenu!.addMenuItem(-202,"Item 2")
rem 'Register the CALLBACK routines
CALLBACK(ON_BUTTON_PUSH,OK,mySysGui!.getContext(),myButton!.getID())
CALLBACK(ON_POPUP_ITEM_SELECT,Item1,myPopupMenu!.getID(),myItem1!.getID())
CALLBACK(ON_POPUP_ITEM_SELECT,Item2,myPopupMenu!.getID(),myItem2!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
rem 'Process Events
process_events
rem 'Callback routine invoked when the user clicks the button
OK:
i = msgbox("OK Button was selected")
return
rem 'Callback routine invoked when the user selects the first item
Item1:
i = msgbox("Item 1 was selected")
return
rem 'Callback routine invoked when the user selects the second item
Item2:
i = msgbox("Item 2 was selected")
return
rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release
|
See Also
BBjAPI
BBjPopupMenu
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.