--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/PDK/Source/GUID-95DD1440-01C9-4997-8DD4-FFD33D7DEAFF.dita Fri Jan 22 18:26:19 2010 +0000
@@ -0,0 +1,58 @@
+<?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-95DD1440-01C9-4997-8DD4-FFD33D7DEAFF" xml:lang="en"><title>Application-specific
+events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p><xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aHandleApplicationSpecificEventL%28TInt%2cconst%20TWsEvent%20%26amp%3b%29" format="application/java-archive"><parmname>CCoeAppUi:HandleApplicationSpecificEventL()</parmname></xref> is
+called for application-specific events where event codes are from <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TKeyEventStruct.html" format="application/java-archive"><parmname>EEventUser</parmname></xref> upwards in <parmname>TEventCode</parmname>. You can define
+a data structure to be delivered in the window server event. The data can
+be accessed through a pointer, which can be obtained by calling<xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TWsEventClass.html#%3a%3aTWsEvent%3a%3aEventData%28%29const" format="application/java-archive"><parmname> TWsEvent::EventData()</parmname></xref>. The maximum event
+data size is defined as <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TWsEventClass.html#%3a%3aTWsEvent%3a%3aEWsEventDataSize" format="application/java-archive"><parmname>EWsEventDataSize</parmname></xref>. </p>
+<codeblock id="GUID-80335267-13AB-49C8-8895-B6598F5D59A4" xml:space="preserve">void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
+</codeblock>
+<p>Code example: </p>
+<p>First define a data structure for the event data:</p>
+<codeblock id="GUID-BBC9DCFA-F46C-4AC9-BC7F-B1A2DB39963A" xml:space="preserve">class TEventsEventType
+ {
+ public:
+ // Event iData
+ TBufC< TWsEvent::EWsEventDataSize> data;
+ };
+</codeblock>
+<p>Then create an event and send it to all window groups:</p>
+<codeblock id="GUID-0E8CE3D4-19F2-46D6-9A22-9A7EBC73F5C5" xml:space="preserve">// Create a window server event
+TWsEvent event;
+TEventsEventType eventType;
+// Set event data. eventType.data = KData;
+event.SetType( ETestEvent1 ); // set event type
+event.SetTimeNow(); // set the event time
+event.SetHandle( iWsSession.WsHandle() ); // set window server handle
+*( TEventsEventType* )( event.EventData() ) = eventType; // set event data
+// Send the created event
+User::LeaveIfError( iWsSession.SendEventToAllWindowGroups( event ) );
+</codeblock>
+<p>Catch the event using the following method:</p>
+<codeblock id="GUID-1BF859E7-EC92-4BDA-AFCE-DEB82854C8D7" xml:space="preserve">void CEventsAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
+ {
+ // Check the event type
+ if( aType == ETestEvent1 )
+ {
+ // Cast to TEventsEventType
+ TEventsEventType event;
+ event = *( TEventsEventType* )aEvent.EventData();
+ // Print the data
+ iEikonEnv->InfoMsg( event.data );
+ }
+ // Call the base class implementation
+ CEikAppUi::HandleApplicationSpecificEventL( aType, aEvent );
+ }
+</codeblock>
+</conbody></concept>
\ No newline at end of file