BBjMDI::getForwardMenuAccelerators

Description

In BBj 6.0 and higher, this method returns a value describing whether the window argument will forward keystrokes to the BBjMDI parent for consideration as menu accelerators.

Syntax

Return Value

Method

boolean

getForwardMenuAccelerators(BBjTopLevelWindowwindow)

Parameters

Variable

Description

window

The method will return the value of the property for the given window.

Return Value

Returns a value describing whether the window will forward keystrokes to the MDI parent window.

0 = The window argument will not forward keystrokes to the MDI parent for menu accelerator consideration.

1 = The window argument will forward keystrokes to the MDI parent for menu accelerator consideration.

Remarks

The default return value is the value of BBjMDI::getDefaultForwardMenuAccelerators() at the creation time the window argument.

Example

sysgui = unt
open(sysgui)"X0"
api! = BBjAPI()
mdi! = api!.getMDI()

rem '
rem ' If we don't have extra arguments, go to the PARENT's setup code.
if (ARGC = 1) then GOSUB SETUP_PARENT else GOSUB SETUP_CHILD FI
process_events

SETUP_CHILD:
    messagePrefix$ = "Child "
    sg! = api!.getSysGui()
    win! = sg!.addWindow(1, 100, 100, 400, 300, "Test", $00010083$)
    win!.setCallback(api!.ON_CLOSE, "CHILD_APP_CLOSE")
    bar! = win!.addMenuBar()
    GOSUB ADD_FILE_SAVE_MENU
    forwarding = mdi!.getForwardMenuAccelerators(win!)
    text$ = "Forwarding Menu Accelerators: "
    checkBox! = win!.addCheckBox(101, 10, 10, 120, 20, text$)
    checkBox!.setSelected(forwarding)
    checkBox!.setCallback(api!.ON_CHECK_ON, "CHILD_BUTTON")
    checkBox!.setCallback(api!.ON_CHECK_OFF, "CHILD_BUTTON")
return

SETUP_PARENT:
    messagePrefix$ = "Parent "

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

    rem 'Add a menubar with a "File" menu and "New", "Save", and "Quit" menu items
    bar! = mdi!.addMenuBar()
    GOSUB ADD_FILE_SAVE_MENU

    rem ' Now add a New and a Quit menu too.
    newItem! = fileMenu!.addMenuItem(-103, "New")
    newItem!.setAccelerator($204E$); REM Ctrl-N
    newItem!.setCallback(api!.ON_MENU_ITEM_SELECT, "PARENT_NEW")
    quitItem! = fileMenu!.addMenuItem(-102, "Quit")
    quitItem!.setAccelerator($2051$); REM Ctrl-Q
    quitItem!.setCallback(api!.ON_MENU_ITEM_SELECT, "PARENT_APP_CLOSE")
    mdi!.setCallback(api!.ON_CLOSE, "PARENT_APP_CLOSE")
    mdi!.setVisible(1)

    rem ' Start child process
    cmdline! = BBjAPI().getConfig().getCurrentCommandLineObject()
    cmdline!.setProgramArgs("child")
    BBjAPI().newBBjSession(cmdline!)

    rem ' Done with SETUP_PARENT
return

rem ' Shared code for adding a file menu and setting the callback for SAVE.
rem ' Requires a menubar to be in the bar! variable. Puts a "File" menu in
rem ' the fileMenu! variable.
ADD_FILE_SAVE_MENU:
    fileMenu! = bar!.addMenu(-101, "File")
    saveItem! = fileMenu!.addMenuItem(-102, "Save")
    saveItem!.setAccelerator($2053$); REM Ctrl-S
    saveItem!.setCallback(api!.ON_MENU_ITEM_SELECT, "SAVE_CALLBACK")
return

rem ' ***********************************************
rem ' ***************** Callbacks *******************
rem ' ***********************************************
rem ' ******************** Shared callbacks ************************
SAVE_CALLBACK:
    PRINT messagePrefix$ + "Save"
return

rem ' ******************** Children callbacks ************************
CHILD_BUTTON:
    mdi!.setForwardMenuAccelerators(win!, ! mdi!.getForwardMenuAccelerators(win!))
return

CHILD_APP_CLOSE:
release

rem ' ******************** Parent callbacks ************************
PARENT_NEW:
    PRINT "Parent New"
return

PARENT_APP_CLOSE:
    res= mdi!.closeAll(0); goto LAB
LAB: release

See Also

BBjAPI

BBjMDI

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