diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-58318BAB-2EC4-4C9E-A7CA-580E701EE54F.dita --- a/Symbian3/PDK/Source/GUID-58318BAB-2EC4-4C9E-A7CA-580E701EE54F.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-58318BAB-2EC4-4C9E-A7CA-580E701EE54F.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,68 +1,68 @@ - - - - - -Adding -and removing toolbar items -

Toolbar items are controls that derive from the CCoeControl base -class. The floating toolbar can have only buttons (CAknButton) if it is focusing. The number of buttons displayed in floating toolbar -depends on the screen resolution in use. The fixed toolbar always has three -buttons.

-

You can define toolbar items either in the resource file or create them -dynamically at runtime.

-

If you define the items in resources, use the TBAR_CTRL structure. -Define at least the type, ID, and the control itself in this structure. For -the resource definitions, see Constructing -the toolbar.

-

To add the items dynamically, use the toolbar functions as illustrated -in the examples below.

-

You can add items to a specific position in toolbar or as the last item -in the toolbar.

-

You can also remove toolbar items at runtime.

-

The example below shows how to add a button dynamically as the last toolbar -item.

- -void CMyAppView::AddItemAsLastToToolbarL() - { - CAknToolbar* toolbar = Toolbar(); - if ( toolbar ) - { - CAknButton* newButton = CAknButton::NewL( R_MYAPP_BUTTON ); - toolbar->AddItemL( newButton, EAknCtButton, KButtonId, 0 ); - } - } - -

The example below shows how to add a button dynamically as the first toolbar -item.

- -void CMyAppView::AddItemAsFirstToToolbarL() - { - CAknToolbar* toolbar = Toolbar(); - if ( toolbar ) - { - CAknButton* newButton = CAknButton::NewL( R_MYAPP_BUTTON ); - // Last parameter the index at where to add the button - toolbar->AddItemL( newButton, EAknCtButton, KButtonId, 0, 0 ); - } - } - -

The example below shows how to remove a button from the toolbar based on -the button ID.

- -void CMyAppView::RemoveItemFromToolbar() - { - CAknToolbar* toolbar = Toolbar(); - if ( toolbar ) - { - toolbar->RemoveItem( KButtonId ); - } - } - + + + + + +Adding +and removing toolbar items +

Toolbar items are controls that derive from the CCoeControl base +class. The floating toolbar can have only buttons (CAknButton) if it is focusing. The number of buttons displayed in floating toolbar +depends on the screen resolution in use. The fixed toolbar always has three +buttons.

+

You can define toolbar items either in the resource file or create them +dynamically at runtime.

+

If you define the items in resources, use the TBAR_CTRL structure. +Define at least the type, ID, and the control itself in this structure. For +the resource definitions, see Constructing +the toolbar.

+

To add the items dynamically, use the toolbar functions as illustrated +in the examples below.

+

You can add items to a specific position in toolbar or as the last item +in the toolbar.

+

You can also remove toolbar items at runtime.

+

The example below shows how to add a button dynamically as the last toolbar +item.

+ +void CMyAppView::AddItemAsLastToToolbarL() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + CAknButton* newButton = CAknButton::NewL( R_MYAPP_BUTTON ); + toolbar->AddItemL( newButton, EAknCtButton, KButtonId, 0 ); + } + } + +

The example below shows how to add a button dynamically as the first toolbar +item.

+ +void CMyAppView::AddItemAsFirstToToolbarL() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + CAknButton* newButton = CAknButton::NewL( R_MYAPP_BUTTON ); + // Last parameter the index at where to add the button + toolbar->AddItemL( newButton, EAknCtButton, KButtonId, 0, 0 ); + } + } + +

The example below shows how to remove a button from the toolbar based on +the button ID.

+ +void CMyAppView::RemoveItemFromToolbar() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + toolbar->RemoveItem( KButtonId ); + } + } +
\ No newline at end of file