SldIncPos Macro

Microchip Graphics Library

Microchip Graphics Library
SldIncPos Macro
C
#define SldIncPos(pSld) \
    SldSetPos                                                                                      \
    (                                                                                              \
        pSld,                                                                                      \
        (((DWORD) pSld->pos + (DWORD) ((SLIDER*)pSld)->page) <= (DWORD) ((SLIDER*)pSld)->range) ?  \
                        (((SLIDER*)pSld)->pos + ((SLIDER*)pSld)->page) : ((SLIDER*)pSld)->range    \
    )
Overview

This macro increment the slider position by the delta change (page) value set. Object must be redrawn after this function is called to reflect the changes to the object.

Input Parameters
Input Parameters 
Description 
pSld 
Pointer to the object. 
Returns

none

Preconditions

none

Side Effects

none

Example
void ControlSpeed(SLIDER* pSld, int setSpeed, int curSpeed)
{
    SldSetPage(pSld, 1);                    // set page size to 1
    if (setSpeed < curSpeed) {
        while(SldGetPos(pSld) < SetSpeed)
            SldIncPos(pSld);                // increment by 1
    }
    else if (setSpeed > curSpeed) {
        while(SldGetPos(pSld) > SetSpeed)   
            SldDecPos(pSld);                // decrement by 1
    }
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved