GOL Messages

Microchip Graphics Library

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:

  1. User Interface Module (touch screen, keypad) sends a GOL message (the GOL_MSG structure).
  2. A loop evaluates which object is affected by the message. This is done inside GOLMsg() function.
  3. Affected object returns the translated message based on the GOL message parameters.
  4. 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.
  5. Object should be redrawn to reflect new state.
The translated message is a set of actions unique to each object type. Please refer to each object translated message ID for details. 

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.
  • The types must be one of the INPUT_DEVICE_TYPE:
    • TYPE_UNKNOWN
    • TYPE_KEYBOARD
    • TYPE_TOUCHSCREEN
    • TYPE_MOUSE
  • uiEvent must be one of the INPUT_DEVICE_EVENT.
    • for touch screen:
      • EVENT_INVALID
      • EVENT_MOVE
      • EVENT_PRESS
      • EVENT_STILLPRESS
      • EVENT_RELEASE
    • for keyboard:
      • EVENT_KEYSCAN (param2 contains scan code)
      • EVENT_KEYCODE (param2 contains character code)
  • param1:
    • for touch screen is the x position
    • for keyboard ID of object receiving the message
  • param2
    • for touch screen y position
    • for keyboard scan or key code
 
Topics
Name 
Description 
The defined scan codes for AT keyboard. 
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved