L_TBSetButtonEnabled

#include "LtTLB.h"

L_LTTLB_API L_INT L_TBSetButtonEnabled(pToolbar, uButtonID, fEnable )

pTOOLBARHANDLE pToolbar;

/* pointer to a toolbar handle */

L_UINT uButtonID;

/* button ID */

L_BOOL fEnable;

/* flag */

Enables or disables the specified button in a toolbar.

Parameter

Description

pToolbar

Pointer to a toolbar handle.

uButtonID

Identifier of the button to enable or disable.

fEnable

Flag that indicates whether to enable or disable the specified button. Possible values are:

 

Value

Meaning

 

TRUE

Enable the specified button.

 

FALSE

Disable the specified button.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes

Comments

To determine whether a button is enabled or disabled, call L_TBIsButtonEnabled.

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_TBIsButtonEnabled.

Topics:

Getting and Setting Toolbar Button Information

Example

 L_INT TBSetButtonEnabledExample( pTOOLBARHANDLE pLeadToolbar,L_UINT uButtonID )
{
   L_INT nRet;
   nRet = L_TBIsValid ( pLeadToolbar );

   if (SUCCESS == nRet ) /* check the validity of the toolbar handle */
   {
      L_BOOL fEnabled;

      /* Get the state of the toolbar button */
      nRet = L_TBIsButtonEnabled ( pLeadToolbar, uButtonID, &fEnabled );
      if(nRet != SUCCESS)
         return nRet;

       if ( fEnabled )
       {
         nRet = L_TBSetButtonEnabled ( pLeadToolbar, uButtonID, FALSE ); /* Disable the button */
         if(nRet != SUCCESS)
            return nRet;
       }
      else
      {
         nRet = L_TBSetButtonEnabled ( pLeadToolbar, uButtonID, TRUE ); /* Enable the button */
         if(nRet != SUCCESS)
            return nRet;
       }

      return SUCCESS ;
   }
   else
      return nRet ;
}