Event()

Syntax

Event = Event()
Description
Return the current event. It is the same value returned by WindowEvent() and WaitWindowEvent(), it is mainly useful when using a callback to determine which event triggered it.

Parameters

None.

Return value

Returns the current event.

Example

  Procedure EventHandler()
    Select Event()
      Case #PB_Event_CloseWindow
        End
        
      Case #PB_Event_Gadget
        Debug "Gadget #" + EventGadget() + " pushed"
    EndSelect
  EndProcedure
  
  OpenWindow(0, 100, 100, 300, 100, "", #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_MaximizeGadget)
  ButtonGadget(0, 10, 10, 100, 30, "Push me")
  
  ; Use a single callback for all events
  BindGadgetEvent(0, @EventHandler())
  BindEvent(#PB_Event_CloseWindow, @EventHandler())
  
  ; We don't process events here, so we can run the loop forever and forget about it
  Repeat
    WaitWindowEvent()
  ForEver

See Also

WindowEvent(), WaitWindowEvent()

Supported OS

All

<- DisableWindow() - Window Index - EventData() ->