Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?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 xml:lang="en" id="GUID-B830A1F7-9220-5879-80BE-C494A4CD155B"><title>Handling General Events</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>When a Window Server event is received, the active scheduler calls the <codeph>RunL()</codeph> function to handle the event. Use <xref href="GUID-643DDA78-C7A7-386D-AB3F-8710141DDDA9.dita#GUID-643DDA78-C7A7-386D-AB3F-8710141DDDA9/GUID-06AA86EE-4494-3990-935A-62B9E995DAC2"><apiname>RWsSession::GetEvent()</apiname></xref> to get the event, a <xref href="GUID-5D0B1595-1AC7-3C44-AC6B-0EFB5EABCF31.dita"><apiname>TWsEvent</apiname></xref>. An event object always has an event type, a <xref href="GUID-420348F5-4A82-3780-9D27-A3E1F4780F0B.dita"><apiname>TEventCode</apiname></xref>, accessed through <xref href="GUID-5D0B1595-1AC7-3C44-AC6B-0EFB5EABCF31.dita#GUID-5D0B1595-1AC7-3C44-AC6B-0EFB5EABCF31/GUID-8FA62E05-3FE8-39B0-81ED-5FBF2D941739"><apiname>TWsEvent::Type()</apiname></xref>, and other data that is useful in handling specific types of event. </p> <p> <b>Variant</b>: <xref href="GUID-D93978BE-11A3-5CE3-B110-1DEAA5AD566C.dita">ScreenPlay</xref> and <xref href="GUID-F64E6551-670E-5E12-8103-DE504D3EC94F.dita">non-ScreenPlay</xref>. <b>Target audience</b>: Application developers. </p> <p>The following example uses a switch statement to execute some function when the associated event type is received. </p> <codeblock id="GUID-696026F1-DA33-5AEC-894E-C09BB9EABAFE" xml:space="preserve">/* Called by active scheduler when an event occurs
Processes events according to their type */
void CExampleWsClient::RunL()
{
// Get the event from the Window Server session iWs
iWs.GetEvent(iWsEvent);
// Get the event type: types are defined in TEventCode
TInt eventType=iWsEvent.Type();/ Process event
switch (eventType)
{
/* Window-group related event types */
...
}</codeblock> </conbody><related-links><link href="GUID-7AC3477E-09C1-519A-9079-DA969B9FC4D7.dita"><linktext>General Events</linktext> </link> <link href="GUID-B7FF0B9C-3A17-5AAA-A986-7BA4F44DBD41.dita"><linktext>Declaring a
Window Server Event-Handling Class</linktext> </link> <link href="GUID-A51D3749-442A-54E8-8EB5-BF907694CD8C.dita"><linktext>Processing Window-Group
Events</linktext> </link> <link href="GUID-E1E11C95-3400-548B-AEEE-577DA8FB9ECB.dita"><linktext>Processing Window Events</linktext> </link> <link href="GUID-930A3ABD-84FB-5D76-938C-79383273DAE6.dita"><linktext>Processing System Events</linktext> </link> </related-links></concept>