BtnCreate Function

Microchip Graphics Library

Microchip Graphics Library
BtnCreate Function
C
BUTTON * BtnCreate(
    WORD ID, 
    SHORT left, 
    SHORT top, 
    SHORT right, 
    SHORT bottom, 
    SHORT radius, 
    WORD state, 
    void * pBitmap, 
    XCHAR * pText, 
    GOL_SCHEME * pScheme
);
Overview

This function creates a BUTTON 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. 
SHORT radius 
Radius of the rounded edge. 
WORD state 
Sets the initial state of the object. 
void * pBitmap 
Pointer to the bitmap used on the face of the button dimension of the bitmap must match the dimension of the button. 
XCHAR * pText 
Pointer to the text of the button. 
GOL_SCHEME * pScheme 
Pointer to the style scheme used. 
Returns

Returns the pointer to the object created.

Preconditions

none

Side Effects

none

Example
GOL_SCHEME *pScheme;
BUTTON *buttons[3];
WORD state;

    pScheme = GOLCreateScheme();
    state = BTN_DRAW;

    buttons[0] = BtnCreate(1,20,64,50,118,0, state, NULL, "ON", pScheme);
    // check if button 0 is created
    if (buttons[0] == NULL)     
       return 0;

    buttons[1] = BtnCreate(2,52,64,82,118,0, state, NULL, "OFF", pScheme);
    // check if button 1 is created
    if (buttons[1] == NULL)
       return 0;

    buttons[2] = BtnCreate(3,84,64,114,118,0, state, NULL, "HI", pScheme);
    // check if button 2 is created
    if (buttons[2] == NULL)
       return 0;

    return 1;
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved