LToolbar::SetButtonEnabled

#include "ltwrappr.h"

L_INT LToolbar::SetButtonEnabled (uButtonID, bEnable)

L_UINT uButtonID;

/* button ID */

L_BOOL bEnable;

/* flag */

Enables or disables the specified button in the toolbar.

Parameter

Description

uButtonID

Identifier of the button to enable or disable.

bEnable

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 LToolbar::IsButtonEnabled.

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:

LToolbar::IsButtonEnabled, Class Members

Topics:

Getting and Setting Toolbar Button Information

Example

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 ;
}