Microchip Graphics Library
|
GOL Messages
To facilitate the processing of user actions on the objects, messaging are used.
User passes messages from the input devices to GOL using the GOL message structure. The structure is described by the following table.
typedef struct { BYTE type; BYTE uiEvent; int param1; int param2; } GOL_MSG;
Field |
Description |
type |
Defines the type of device where the message was created. These are the devices implemented in the User Interface Layer. Possible device types are the following: TYPE_UNKNOWN TYPE_KEYBOARD TYPE_TOUCHSCREEN TYPE_MOUSE |
uiEvent |
Event ID of the user or device type action on the object. Possible event IDs are the following: EVENT_INVALID EVENT_MOVE EVENT_PRESS EVENT_STILLPRESS EVENT_RELEASE EVENT_KEYSCAN EVENT_CHARCODE |
param1 param2 |
Parameters 1 and 2 definition varies from device types. For example, param1 and param2 are defined as x-coordinate position and y-coordinate position respectively for TYPE_TOUCHSCREEN. For TYPE_KEYBOARD, param1 is defined as the ID of the receiving object and param2 is defined as the keyboard scan or character code. |
GOLMsg() function accepts this structure and processes the message for all objects in the active list.
Messaging Flow
The messaging mechanism follows this flow:
- User Interface Module (touch screen, keypad) sends a GOL message (the GOL_MSG structure).
- A loop evaluates which object is affected by the message. This is done inside GOLMsg() function.
- Affected object returns the translated message based on the GOL message parameters.
- User can change default action with the callback function. If the call back function returns a non-zero value message will be processed by default.
- Object should be redrawn to reflect new state.
Objects that are disabled will not accept any messages. GOLMsg() function must be called when GOL drawing is completed. In this case all objects have been drawn and it is safe to change objects states. GOLMsg() call can be done if GOLDraw() function returns non-zero or inside GOLDrawCallback() function.
Enumerations
Name |
Description |
This structure defines the list of translated messages for GOL Objects used in the library. | |
This structure defines the types of GOL message events used in the library. | |
This structure defines the types of input devices used in the library. |
Functions
|
Name |
Description |
|
This function receives a GOL message from user and loops through the active list of objects to check which object is affected by the message. For affected objects the message is translated and GOLMsgCallback() is called. In the call back function, user has the ability to implement action for the message. If the call back function returns non-zero OBJMsgDefault() is called to process message for the object by default. If zero is returned OBJMsgDefault() is not called. Please refer to GOL Messages section for deatils. This function should be called when GOL drawing is completed. It can be done... more | |
|
The user MUST implement this function. GOLMsg() calls this function when a valid message for an object in the active list is received. User action for the message should be implemented here. If this function returns non-zero, the message for the object will be processed by default. If zero is returned, GOL will not perform any action. |
Structures
Name |
Description |
This structure defines the GOL message used in the library.
|
Topics
Name |
Description |
The defined scan codes for AT keyboard. |
Links