Events, Variables, and Flags.
XLnt is an Events driven program - this means that you setup your windows and stuff, and wait for something to happen. Different actions by the user cause different Events to be registered by the program, eg, clicking on a gadget, moving a slider, accessing a menu. Most of these events are handled internally by the clever XLnt code - whilst some are returned to the programmer who can then decide what action to take.
Internal GUI events are stored in the string$ GUI_WINEVENT$ and GUI_GADEVENT$, you should never need to access these, but feel free to take a look at 'em.
Events that are returned to the programmer are stored in the variable EVENT$ - which is usualy checked once per loop. They are the following:
Please Note : all Events are returned in UpperCase - be warned :P
Event$ Contains
Caused by?
GUI_GADHIT
The user has clicked on a gadget
MENU
A normal menu has been accessed by the user
QMENU
A Quick Menu has been acccessed by the user
KILLWIN
The user has clicked on a Window Close Button (the X at the top
left)
TEXT INPUT
Some text has been entered into an input gadget
SCROLLER
A slider is being moved
KEYHIT
A key has been hit (Duh!)
But how do I use these events? Well, you use them in conjunction with the Event Variables (below) and a simple loop. During the course of execution, XLnt constantly changes a few global variables according to user activity. These variables contain things such as the last gadget hit, the last menu item to be selected, the currently active window etc. These are listed below:
Variable Name | Contains What? |
GUI_GADHIT |
ID of gadget that has been hit |
GUI_GROUPHIT | ID of gadget group selected |
GUI_MENUHIT | ID of last menu item hit |
GUI_QMENUHIT | ID of last Quick Menu item hit |
GUI_ACTIVEWIN | ID of currently active window |
GUI_WINHOVER | ID of window that mouse is over ("NULL" if over none) |
GUI_QUICKMENU | ID of current Quick Menu |
GUI_QMENU_ON | [TRUE] Quick Menus ON [FALSE] Quick Menus OFF |
GUI_BACK_ON | [TRUE] Display BackGround Image [FALSE] Don't display image |
GUI_BG | Pointer to background image |
GUI_BG_X | X-Offset of background image |
GUI_BG_Y | Y-Offset of background image |
GUI_BG_VX | X-Position of background image viewport |
GUI_BG_VY | Y-Position of background image viewport |
GUI_BG_VW | Width of background image viewport |
GUI_BG_VH | Height of background image viewport |
GUI_MOUSE | Pointer to mouse image |
GUI_MOUSE_ON | [TRUE] Display mouse pointer [FALSE] turn off mouse pointer |
GUI_KEYLOCK | [TRUE] turn off arrow keys etc [FALSE] turn on arrow keys |
GUI_3DPORT | ID of last selected 3D View gadget or "NULL" |
Now check out the Example to see how we use these things.....