L_TBSetButtonChecked

#include "LtTLB.h"

L_LTTLB_API L_INT L_TBSetButtonChecked (pToolbar, uButtonID )

pTOOLBARHANDLE pToolbar;

/* pointer to a toolbar handle */

L_UINT uButtonID;

/* button ID */

Selects (checks) the given button in the toolbar.

Parameter

Description

pToolbar

Pointer to a toolbar handle.

uButtonID

Identifier of the button to select (check) .

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes

Comments

Only one button may be selected (checked) at a time.

To determine whether a button is selected (checked), call L_TBGetButtonChecked.

Required DLLs and Libraries

LTTLB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_TBGetButtonChecked

Topics:

Getting and Setting Toolbar Button Information

Example

This example will check the current check button in the toolbar and then if the checked button is not equal the required button, the required button will be checked

L_INT TBSetButtonCheckedExample( pTOOLBARHANDLE pLeadToolbar,L_UINT uButtonID )
{
   L_INT nRet;
   /* check the validity of the toolbar handle */
   nRet = L_TBIsValid ( pLeadToolbar );

   if (SUCCESS == nRet )
   {
      L_INT nCheckedID ;

      /* Get the current checked button in the toolbar */
      nRet = L_TBGetButtonChecked ( pLeadToolbar, &nCheckedID ) ;
      if(nRet != SUCCESS)
         return nRet;

      if ( nCheckedID != (L_INT ) uButtonID )
      {
         nRet = L_TBSetButtonChecked ( pLeadToolbar, uButtonID ) ; /* Check the required button */
         if(nRet != SUCCESS)
            return nRet;
      }

      return SUCCESS ;
   }
   else
      return nRet ;
}