BBjPopupMenu::isVisible

Description

In BBj 16.0 and higher, this method returns whether a BBjPopupMenu is visible.

Syntax

Return Value

Method

boolean

isVisible()

Parameters

None.

Return Value

Returns whether the BBjPopupMenu is visible (0 = Invisible, 1 = Visible).

Remarks

None.

Example

rem 'BBjPopupMenu::isVisible

rem 'Obtain the instance of the BBjAPI object
let myAPI! = BBjAPI()

rem 'Open the SysGui device
SYSGUI = UNT
OPEN (SYSGUI)"X0"

rem ' For retrieving the event string
dim event$:tmpl(sysgui)

rem 'Obtain the instance of the BBjSysGui object
let mySysGui! = myAPI!.getSysGui()

rem 'Set addWindow param values
X = 100
Y = 100
WIDTH = 200
HEIGHT = 200
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 control and associate a popup menu with it.
myButton! = myWindow!.addButton(1,10,10,90,30,"OK")
myPopupMenu! = myButton!.addPopupMenu()
myItem1! = myPopupMenu!.addMenuItem(201,"Item 1")
myItem2! = myPopupMenu!.addMenuItem(202,"Item 2")

rem ' Create an inpute control and associate the same popup menu
myInputE! = myWindow!.addInputE(2,10,50,90,30)
myInputE!.setPopupMenu(myPopupMenu!)

rem ' Create an inputd control and don't associate a popup menu
myInputD! = myWindow!.addInputD(3,10,100,90,30)

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_POPUP_REQUEST,PopupRequest,mySysGui!.getContext(),myInputD!.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:
    event$ = mySysGui!.getLastEventString()
    i = msgbox("Item 1 was selected on context "+str(event.context)+"; id="+str(event.id)+"; code="+event.code$+"; flags="+hta(event.flags$)+"; x="+str(event.x)+"; y="+str(event.y))
return

rem 'Callback routine invoked when the user selects the second item
Item2:
    event$ = mySysGui!.getLastEventString()
    i = msgbox("Item 2 was selected on context "+str(event.context)+"; id="+str(event.id)+"; code="+event.code$+"; flags="+hta(event.flags$)+"; x="+str(event.x)+"; y="+str(event.y))
return

PopupRequest:
    event$ = mySysGui!.getLastEventString()
    print "PopupRequest: Context="+str(event.context)+" id="+str(event.id)+" code="+event.code$+" flags="+hta(event.flags$)+" x="+str(event.x)+" y="+str(event.y)+"; isVisible? ",myPopupMenu!.isVisible()
    myPopupMenu!.show(event.context,event.id,event.x,event.y)
    print "isVisible? ",myPopupMenu!.isVisible()
return

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

See Also

BBjAPI

BBjSysGui

BBjControl

BBjPopupMenu

BBjMenu

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