BBjMDI::getMenuButton

Description

In BBj 14.0 and higher, this method returns a menu button control that was previously added to the BBjMDI window.

Syntax

Return Value

Method

BBjMenuButton

getMenuButton(int ID)

Parameters

Variable

Description

ID

Specifies the control ID number of a BBjMenuButton control that was previously added to this BBjMDI window

Return Value

Returns a BBjMenuButton object.

Remarks

None.

Example

rem ' getMenuButton

open (unt)"X0"
sysgui! = BBjAPI().getSysGui()
mdi! = BBjAPI().getMDI()
mdi!.createMDIWindow(100,100,250,200,"MDI Window")

rem ' Create Menu Buttons
mb1! = mdi!.addMenuButton(101,0,0,80,30,"Open")
mb1! = mdi!.getMenuButton(101)
mb2! = mdi!.addMenuButton(102,0,0,80,30,"Save")
mb2! = mdi!.getMenuButton(102)
mb3! = mdi!.addMenuButton(103,0,0,80,30,"Print")
mb3! = mdi!.getMenuButton(103)
mb1!.setCallback(mb1!.ON_BUTTON_PUSH,"mb1")
mb2!.setCallback(mb1!.ON_BUTTON_PUSH,"mb2")
mb3!.setCallback(mb1!.ON_BUTTON_PUSH,"mb3")

rem ' Create dropdown menu(s)
dropdownMenu! = sysgui!.addPopupMenu()
dropdownItem1! = dropdownMenu!.addMenuItem(-201,"Dropdown Item 1")
dropdownItem2! = dropdownMenu!.addMenuItem(-202,"Dropdown Item 2")

rem 'Associate dropdown menu(s) with the buttons
mb1!.setDropdownMenu(dropdownMenu!)
mb2!.setDropdownMenu(dropdownMenu!)
mb3!.setDropdownMenu(dropdownMenu!)

rem ' Add Images
ImageManager!=sysgui!.getImageManager()
openImage!=ImageManager!.loadImageFromFile("open.png",err=*next)
mb1!.setImage(openImage!)
saveImage!=ImageManager!.loadImageFromFile("save.png",err=*next)
mb2!.setImage(saveImage!)
printImage!=ImageManager!.loadImageFromFile("print.png",err=*next)
mb3!.setImage(printImage!)

CALLBACK(ON_POPUP_ITEM_SELECT,DropdownItem1,dropdownMenu!.getID(),dropdownItem1!.getID())
CALLBACK(ON_POPUP_ITEM_SELECT,DropdownItem2,dropdownMenu!.getID(),dropdownItem2!.getID())
CALLBACK(ON_CLOSE,APP_CLOSE,mdi!.MDI_CONTEXT)

process_events

APP_CLOSE:
    mdi!.closeAll(0)
release

mb1:
    print "1"
return

mb2:
    print "2"
return

mb3:
    print "3"
return

DropdownItem1:
    i=msgbox("Dropdown Item 1")
return

DropdownItem2:
    i=msgbox("Dropdown Item 2")
return

See Also

BBjAPI

BBjMDI

BBjMenuButton

Object Variables

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