Enables or disables the specified button in the toolbar.
#include "ltwrappr.h"
L_INT LToolbar::SetButtonEnabled (uButtonID, bEnable)
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 LToolbar::IsButtonEnabled.
L_INT LToolbar__SetButtonEnabledExample(L_UINT uButtonID, LToolbar* tlb)
{
L_INT nRet;
if ( tlb->IsValid () ) /* check the validity of the toolbar handle */
{
L_BOOL bEnabled ;
/* Get the state of the toolbar button */
bEnabled = tlb->IsButtonEnabled (uButtonID) ;
if ( bEnabled )
{
/* Disable the button */
nRet = tlb->SetButtonEnabled (uButtonID, FALSE ) ;
if(nRet != SUCCESS)
return nRet;
}
else
{
/* Enable the button */
nRet = tlb->SetButtonEnabled (uButtonID, TRUE ) ;
if(nRet != SUCCESS)
return nRet;
}
}
else
{
return FAILURE ;
}
return SUCCESS ;
}