Symbian3/SDK/Source/GUID-7AE34C8A-50C6-49BA-9E43-AE76873B5E12.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-7AE34C8A-50C6-49BA-9E43-AE76873B5E12.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-7AE34C8A-50C6-49BA-9E43-AE76873B5E12" xml:lang="en"><title>Handling
+toolbar item events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<section>      <p>To be able to receive toolbar item events in your application
+or application view, you must implement the toolbar observer interface in
+the view and register the view to the toolbar:</p> <p>To receive toolbar item
+events, use the observer class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classMAknToolbarObserver.html" format="application/java-archive"><codeph>MAknToolbarObserver</codeph></xref>.</p>      <p>The example below shows how to set the toolbar observer.</p> 
+    <codeblock xml:space="preserve">void CMyAppView::ConstructL( TInt aResId )
+    {
+    BaseConstructL( aResId );
+    CAknToolbar* toolbar = Toolbar();
+    if ( toolbar )
+        {
+        toolbar-&gt;SetToolbarObserver( this );
+        }
+    }
+</codeblock>     </section>
+<section>       <p>Handle toolbar item events in <codeph>MAknToolbarObserver</codeph>’s <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classMAknToolbarObserver.html#af95495179253d4ce78609feb8c64d14" format="application/java-archive"><codeph>OfferToolbarEventL()</codeph></xref>.</p><p><codeph>OfferToolbarEventL()</codeph> is called when the toolbar
+item state has changed, for example when a button is pressed. When handling
+a toolbar event, the control in question can be identified from the commandid
+that is sent as a parameter in the method. The ID belongs to that control
+it was sent from (in case of a button, the ID of the button that was pressed).</p> 
+           <p>The example below illustrates how to implement <codeph>OfferToolBarEventL()</codeph>.</p> 
+     <codeblock xml:space="preserve">void CMyAppView::OfferToolbarEventL( TInt aCommandId )
+    {
+    if ( aCommandId == KButtonId )
+        {
+        // do button function
+        …
+        }
+    }
+</codeblock></section>
+</conbody></concept>
\ No newline at end of file