BBjMDI::addMenuBar

Description

In BBj 3.00 and higher, this method adds a menu bar to the BBjMDI window.

Syntax

Return Value

Method

BBjMenuBar

addMenuBar()

Parameters

None.

Return Value

None.

Remarks

None.

Example

rem 'Open SYSGUI Channel

OPEN (UNT)"X0"

rem 'retrieve the MDIProxy
MDI! = BBjAPI().getMDI()

rem 'create an MDI Window
mdi!.createMDIWindow(50, 50, 800, 600, "MDI Window")

rem 'add menu items to the MDI Window
menuBar! = mdi!.addMenuBar()
AMenu! = menuBar!.addMenu(20,"Sample menu")
MenuItem201! = AMenu!.addMenuItem(201, "Set BBj Command line params")
MenuItem202! = AMenu!.addMenuItem(202, "Set Program Command line params")
MenuItem203! = AMenu!.addMenuItem(203, "Run Program")
MenuItem204! = AMenu!.addMenuItem(204, "add toolbars")
MenuItem205! = AMenu!.addMenuItem(205, "Enable MDI WindowsMenu")

rem 'set callbacks
MenuItem201!.setCallback(menuBar!.ON_MENU_ITEM_SELECT, "selected_201")
MenuItem202!.setCallback(menuBar!.ON_MENU_ITEM_SELECT, "selected_202")
MenuItem203!.setCallback(menuBar!.ON_MENU_ITEM_SELECT, "selected_203")
MenuItem204!.setCallback(menuBar!.ON_MENU_ITEM_SELECT, "selected_204")
MenuItem205!.setCallback(menuBar!.ON_MENU_ITEM_SELECT, "selected_205")
CALLBACK(ON_CLOSE,APP_CLOSE,mdi!.MDI_CONTEXT)

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
    mdi!.closeAll(0)
return

selected_201:
    print (0,ERR = doReturn) 'GETS'("","commandLineParams: ", cmdLineParams$)
    read cmdLineParams$
return

selected_202:
    print (0,ERR = doReturn) 'GETS'("","ProgramParams: ", programParams$)
    read programParams$
return

selected_203:
    filename$ = fileopen("choose file","/","","")
    if filename$ <> "::CANCEL::"
        command$ = "bbj " + cmdLineParams$ + " " + filename$ + " - " + programParams$ + " &"
        print "scalling: " , command$
        x = scall(command$)
    endif
return

selected_204:
    tb1! = mdi!.addToolButton(101,0,0,20,20,"1",$4000$)
    tb2! = mdi!.addToolButton(102,0,0,20,20,"2",$4000$)
    tb3! = mdi!.addToolButton(103,0,0,20,20,"3",$4000$)
    tb1!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb1")
    tb2!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb2")
    tb3!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb3")
    menuItem204!.setEnabled( 0 )
return

TB1:
    print "1"
return

TB2:
    print "2"
return

TB3:
    print "3"
return

selected_205:
    mdi!.enableMDIWindowMenu()
    menuItem205!.setEnabled( 0 )
return

doReturn:
return

See Also

BBjAPI

BBjMDI

Object Variables

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