SG_HideGadget

Syntax:

SG_HideGadget(SG_GadgetID_L.l, State_L.l)

Parameters:

SG_GadgetID_L

=

The number of the gadget

State_L

=

the state of the gadget (0 or 1)


Description:

Hide or show a gadget. If State = 1, the gadget will be hidden, if State = 0 it will be shown.


Example:

#TrackBar_0 = 0
#Button_0 = 1

If Not InitSprite() Or Not InitMouse() Or Not InitKeyboard()
  End
EndIf

If OpenWindow(1, 0, 0, 1024, 768, "Screen Gadget HideGadget", #PB_Window_BorderLess)
  If OpenWindowedScreen(WindowID(1), 0,0, 1024, 768, 0, 0, 0)
    ; create a mouse
    If CreateSprite(0, 8, 8) 
      If StartDrawing(SpriteOutput(0)) 
        Circle(4, 4, 4, RGB(255, 255, 255)) 
        StopDrawing()
      EndIf 
    EndIf
    
    SG_ButtonGadget(#Button_0, 600, 500, 90, 20, "Hide", #PB_Button_Toggle)
    SG_TrackBarGadget(#TrackBar_0, 700, 500, 200, 20, 1, 100)
    
    Repeat
      ClearScreen(0)
      SG_DrawGadgets()
      ExamineMouse() 
      DisplayTransparentSprite(0, MouseX(), MouseY())
      FlipBuffers()
      
      Event = SG_ScreenGadgetEvent() ; This line checks if an event happened and resolve the mouse actions with the gadgets
      GadgetID = SG_EventScreenGadgetID() ; Is it a gadget event?
      EventType = SG_EventType() ; The event type
      
      If Event = #PB_Event_Gadget And EventType = #SG_EventType_LeftRelease
        
        If GadgetID = #TrackBar_0
          Debug SG_GetGadgetState(#TrackBar_0)
        EndIf
        
        If GadgetID = #Button_0
          SG_HideGadget(#TrackBar_0, SG_GetGadgetState(#Button_0))
        EndIf
        
      EndIf
      
      
      
    Until WaitWindowEvent() = #PB_Event_CloseWindow Or MouseButton(2)
  EndIf
  
  
EndIf

End

Remarks:



Supported OS:   Windows