Enables or disables the specified button in a toolbar.
#include "LtTLB.h"
L_LTTLB_API L_INT L_TBSetButtonEnabled(pToolbar, uButtonID, fEnable)
Pointer to a toolbar handle.
Identifier of the button to enable or disable.
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes |
To determine whether a button is enabled or disabled, call L_TBIsButtonEnabled.
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.
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 ;
}