SetState Macro

Microchip Graphics Library

Microchip Graphics Library
SetState Macro
C
#define SetState(pObj, stateBits) ((OBJ_HEADER *)pObj)->state |= (stateBits)
Overview

This macro sets the state bits of an object. Object must be redrawn to display the changes. It is possible to set several state bits with this macro.

Input Parameters
Input Parameters 
Description 
pObj 
Pointer to the object of interest. 
stateBits 
Defines which state bits are to be set. Please refer to specific objects for object state bits definition for details 
Returns

none

Preconditions

none

Side Effects

none

Example
void BtnMsgDefault(WORD msg, BUTTON* pB){
    switch(msg){
        case BTN_MSG_PRESSED:
            // set pressed and redraw
            SetState(pB, BTN_PRESSED|BTN_DRAW);
            break;
        case BTN_MSG_RELEASED:
            ClrState(pB, BTN_PRESSED);       // reset pressed
            SetState(pB, BTN_DRAW);          // redraw
            break;
    }
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved