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

LToolbar tlb;

L_INT ToggleToolbarButton (L_UINT uButtonID )
{
   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 */
         tlb.SetButtonEnabled (uButtonID, FALSE ) ;   
      }
      else
      {
         /* Enable the button */
         tlb.SetButtonEnabled (uButtonID, TRUE ) ;   
      }

      return SUCCESS ;
   }
   else
   {
      return FAILURE ;
   }
}