C
METER * MtrCreate( WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, SHORT value, SHORT minValue, SHORT maxValue, void * pTitleFont, void * pValueFont, XCHAR * pText, GOL_SCHEME * pScheme );
Overview
This function creates a METER object with the parameters given. It automatically attaches the new object into a global linked list of objects and returns the address of the object.
Input Parameters
Input Parameters |
Description |
WORD ID |
Unique user defined ID for the object instance. |
SHORT left |
Left most position of the object. |
SHORT top |
Top most position of the object. |
SHORT right |
Right most position of the object. |
SHORT bottom |
Bottom most position of the object. |
WORD state |
Sets the initial state of the object. |
SHORT value |
Initial value set to the meter. |
SHORT minValue |
The minimum value the meter will display. |
SHORT maxValue |
The maximum value the meter will display. |
void * pTitleFont |
Pointer to the font used for the Title. |
XCHAR * pText |
Pointer to the text label of the meter. |
GOL_SCHEME * pScheme |
Pointer to the font used for the Value. Pointer to the style scheme used. |
Returns
Returns the pointer to the object created.
Preconditions
none
Side Effects
none
Example
#define ID_METER 101 extern const FONT_FLASH GOLMediumFont; // medium font extern const FONT_FLASH GOLSmallFont; // small font GOL_SCHEME *pMeterScheme; METER *pMtr; pMeterScheme = GOLCreateScheme(); pMtr = MtrCreate( ID_METER, // assign ID 30, 50, 150, 180, // set dimension MTR_DRAW|MTR_RING, // draw object after creation 0, // set initial value 0, 100, // set minimum and maximum value (void*)&GOLMediumFont, // set title font (void*)&GOLSmallFont, // set value font "Speed", // Text Label pMeterScheme); // style scheme // check if meter was created if (pMtr == NULL) return 0; // Change range colors: Normal values to WHITE // Critical values to BLUE // Danger values to RED // assume that WHITE, GREEN, YELLOW and RED have been defined. MtrSetScaleColors(pMtr, WHITE, WHITE, WHITE, GREEN, YELLOW, RED); // use GOLDraw() to draw the meter and all other objects you created while(!GOLDraw()); // OR to draw the meter manually use this: //while(!MtrDraw(pMtr);