Setting properties for button states

The state-specific properties and the methods used for setting them for the generic button include the following:

Property

Method in CAknButtonState.

Text

CAknButtonState::SetTextL()

Icon

  • Dimmed state: CAknButtonState::SetDimmedIcon()

  • Normal state: CAknButtonState::SetIcon()

  • Pressed-down state: CAknButtonState::SetPressedIcon()

Flags

CAknButtonState::SetFlags()

Help text

CAknButtonState::SetHelpTextL()

// Set second state as having latched frame 
button->State( 1 )->SetFlags( KAknButtonStateHasLatchedFrame ); 

// Set text and help text to second state 
HBufC* buttonText = StringLoader::LoadLC( R_MYAPP_BUTTON_TEXT );    
HBufC* buttonHelpText = StringLoader::LoadLC( R_MYAPP_BUTTON_HELP_TEXT );    
button->State( 1 )->SetTextL( *buttonText ); 
button->State( 1 )->SetHelpTextL( *buttonHelpText ); 
CleanupStack::PopAndDestroy( 2 ); // buttonText, buttonHelpText