FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

MENUS

Enable/Disable submenus


You cannot use FB's MENU commands to enable or disable menu items that have submenus. Instead you must use the Toolbox functions. Here's some code I use to enable and disable hierarchial Font and Size submenus that are on my Edit menu.

mHndl& = FN GETMHANDLE(_editMenu)
LONG IF mHndl&
  CALL ENABLEITEM(mHndl&,_fontItem)
  CALL ENABLEITEM(mHndl&,_sizeItem)
END IF

mHndl& = FN GETMHANDLE(_editMenu)
LONG IF mHndl&
  CALL DISABLEITEM(mHndl&,_fontItem)
  CALL DISABLEITEM(mHndl&,_sizeItem)
END IF

For youppliion, the following function should work:

LOCAL FN hndlMenuOne (state%)
  DIM i, mHndl&
  mHndl&= FN GETMHANDLE(1)
  LONG IF mHndl&
    FOR i = 1 TO 4
      LONG IF state% = _enable
        CALL ENABLEITEM(mHndl&,i)
      XELSE
        CALL DISABLEITEM(mHndl&,i)
      END IF
    NEXT i
  END IF
END FN

Greg