RbGetCheck Function

Microchip Graphics Library

Microchip Graphics Library
RbGetCheck Function
C
WORD RbGetCheck(
    RADIOBUTTON * pRb
);
Overview

This function returns the ID of the currently checked Radio Button in the group.

Input Parameters
Input Parameters 
Description 
RADIOBUTTON * pRb 
Pointer to the Radio Button in the group. 
Returns

Returns the ID of the selected button in the group. It returns -1 if there is no object checked.

Preconditions

none

Side Effects

none

Example
GOL_SCHEME *pScheme;
RADIOBUTTON *pRb[3];
SHORT ID;

    pScheme = GOLCreateScheme();
    pRb[0] = RbCreate(ID_RADIOBUTTON1,              // ID
                      255,40,310,80,                // dimension
                      RB_DRAW|RB_GROUP|RB_CHECKED,  // will be dislayed and
                                                    // focused after creation
                                                    // first button in the group
                      "RB1",                        // text
                      pScheme);                     // scheme used

    pRb[1] = RbCreate(ID_RADIOBUTTON2,              // ID
                      255,85,310,125,               // dimension
                      RB_DRAW,                      // will be dislayed and
                                                    // checked after creation
                      "RB2",                        // text
                      pScheme);                     // scheme used

    pRb[2] = RbCreate(ID_RADIOBUTTON3,              // ID
                      255,130,310,170,              // dimension
                      RB_DRAW,                      // will be dislayed and
                                                    // disabled after creation
                      "RB3",                        // text
                      pScheme);                     // scheme used

    // draw the Radio Buttons here
    
    ID = RbGetCheck(pRb[2]);                        // can also use pRb[1] or
                                                    // pRb[0] to search the
                                                    // checked radio button of the
                                                    // group. ID here should
                                                    // be ID_RADIOBUTTON1
    if (ID == ID_RADIOBUTTON1) {
        // do something here then clear the check
        ClrState(pRb[0], RB_CHECKED);               
        // Change the checked object. Pointer used is any of the three.
        // the ID used will find the correct object to be checked   
        RbSetCheck(pRb[3], ID_RADIOBUTTON2);        
    }
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved