HideMenu()

Syntax

HideMenu(#Menu, State)
Description
Hide or show the specified menu.

Parameters

#Menu The menu to hide or show.
State The new state for the menu. A value of 1 hides the menu and a value of 0 shows it.

Return value

None.

Example

  If OpenWindow(0, 200, 200, 300, 100, "HideMenu Example")
    ButtonGadget(0, 70, 10, 150, 30, "Hide/Show menu")
    If CreateMenu(0, WindowID(0))
      MenuTitle("Project")
      MenuItem(1, "New")
      MenuItem(2, "Open")
    EndIf
    
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_Gadget
          Select EventGadget()
            Case 0
              ; Set the toggle status (on/off) of the menu:
              Toggle = Bool(Not Toggle)
              HideMenu(0, Toggle)
              ; Adjusts the y-position of the button according to the presence of the menu:
              If Toggle
                ResizeGadget(0, #PB_Ignore, 10 + MenuHeight(), #PB_Ignore, #PB_Ignore)
              Else
                ResizeGadget(0, #PB_Ignore, 10, #PB_Ignore, #PB_Ignore)
              EndIf
          EndSelect
        Case #PB_Event_CloseWindow
          Break
      EndSelect
    ForEver
  EndIf

See Also

CreateMenu(), CreateImageMenu()

Supported OS

Windows, Linux

<- GetMenuTitleText() - Menu Index - IsMenu() ->