Events
From IfsoGUIWiki
Contents |
Events
The events generated by the gadgets can be utilized in two ways. You can choose to use either method, or both if you desire.
- Method 1: The events are added to an event queue. In the update loop of your application, you can pull the events from the queue and act on them if necessary. You should check for events every loop, as the event queue is cleared at the beginning of each loop, and then new events are added to it.
- Method 2: The gadgets can be assigned a callback function that will be called when the gadget generates an event. Using this method, you do not need to monitor the queue.
Event IDs
Each gadget only generates a subset of events that pertain to it. For the events generated by a specific gadget, see the documentation for the gadget.
- ifsoGUI_EVENT_CLICK – Gadget has been clicked with the mouse.
- ifsoGUI_EVENT_DOUBLE_CLICK – Gadget has been double clicked with the mouse.
- ifsoGUI_EVENT_RIGHT_CLICK – Gadget has been right clicked.
- ifsoGUI_EVENT_MIDDLE_CLICK – Gadget has been middle clicked.
- ifsoGUI_EVENT_MOUSE_ENTER – Mouse has moved over the gadget. Only occurs once, the first time the mouse enters the gadget.
- ifsoGUI_EVENT_MOUSE_EXIT – Mouse has moved away from the gadget.
- ifsoGUI_EVENT_MOUSE_DOWN – Mouse button has been pressed down on the gadget.
- ifsoGUI_EVENT_MOUSE_UP – Mouse button has been released on the gadget.
- ifsoGUI_EVENT_MOUSE_MOVE – Mouse has been moved over the gadget. This event is generated every time the mouse moves while over the gadget.
- ifsoGUI_EVENT_CHANGE – Gadget’s value has changed.
- ifsoGUI_EVENT_KEYHIT – Key was pressed while the gadget has focus.
- ifsoGUI_EVENT_GAIN_FOCUS – Gadget has gained the focus.
- ifsoGUI_EVENT_LOST_FOCUS – Gadget has lost the focus.
- ifsoGUI_EVENT_RESIZE – Gadget has been resized by the user.
- ifsoGUI_EVENT_CELL_CHANGE - The value in a cell has changed.
- ifsoGUI_EVENT_CUT - User has requested a cut from.
- ifsoGUI_EVENT_COPY - User has requested a copy.
- ifsoGUI_EVENT_PASTE - User has requested a paste.
Event Type
Type: ifsoGUI_Event
Module: ifsogui.gui
Fields
- gadget:ifsoGUI_Base – Gadget that fired the event.
- id:Int – Event ID.
- x:Int, y:Int – Mouse Position of the event. This may be 0, -1 or used for another purpose like cell x and y position.
- data:Int – Extra data of the event. This will be specific to the Event, containing information about the event, like the index of an item in a Listbox, or which mouse button was pressed.
Functions
- EventString:String(id:Int) - Returns the const string associated with an event id. This is useful for debugging purposes.
