BindGadgetEvent()
Syntax
BindGadgetEvent(#Gadget, @Callback() [, EventType])Description
Bind a gadget event to a callback. It allows to have real-time event notifications as the callback can be invoked as soon as the event occurs (useful for ScrollAreaGadget() etc.). A gadget event can be unbinded with UnbindGadgetEvent().
Parameters
#Gadget The gadget to bind the event to. @Callback() The callback procedure to call when the event occurs. It has to be declared like this: Procedure EventHandler() ; Code EndProcedureRegular functions like EventGadget(), EventWindow(), EventMenu(), EventType() and EventData() are available within the callback to get more information about the event.EventType (optional) The event type to bind the event to. For a full list of supported types, see EventType(). #PB_All can be used to bind the event to any type.
Return value
None.
Example
Procedure ButtonHandler() Debug "Button click event on gadget #" + EventGadget() EndProcedure OpenWindow(0, 100, 100, 200, 50, "Click test", #PB_Window_SystemMenu) ButtonGadget(0, 10, 10, 180, 30, "Click me") BindGadgetEvent(0, @ButtonHandler())
See Also
BindGadgetEvent(), BindMenuEvent(), UnbindEvent()
Supported OS
All