HideGadget()

Syntax

HideGadget(#Gadget, State)
Description
Hide or show a gadget.

Parameters

#Gadget The gadget to use.
State The new state of the gadget. If State = 1, the gadget will be hidden, if State = 0 it will be shown.

Return value

None.

Example

  If OpenWindow(0, 0, 0, 180, 120, "HideGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ButtonGadget(0, 10, 10, 160, 50, "Button 1")       : button = #True   ; Button is displayed
    ButtonGadget(1, 10, 80, 160, 30, "Hide Button 1")
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Gadget
        If EventGadget() = 1
          If button = #True     ; ButtonGadget is displayed
            HideGadget(0, 1)     ; => hide it
            button = #False
            SetGadgetText(1, "Show Button 1")
          Else                  ; ButtonGadget is hidden
            HideGadget(0, 0)     ; => show it
            button = #True
            SetGadgetText(1, "Hide Button 1")
          EndIf
        EndIf
      EndIf
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

DisableGadget()

Supported OS

All

<- GetGadgetText() - Gadget Index - HyperLinkGadget() ->