Symbian3/SDK/Source/GUID-3729C075-4958-4874-9DD7-02A68D17E043.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-3729C075-4958-4874-9DD7-02A68D17E043" xml:lang="en"><title>Other
window server events</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p> When an event occurs under the window server, the framework calls the <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aHandleWsEventL%28const%20TWsEvent%20%26amp%3b%2cCCoeControl%20%2a%29" format="application/java-archive"><parmname>HandleWsEventL()</parmname></xref> function of the UI controller
object. To implement an event-handling code for a certain event, <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aHandleWsEventL%28const%20TWsEvent%20%26amp%3b%2cCCoeControl%20%2a%29" format="application/java-archive"><parmname>HandleWsEventL()</parmname></xref> must be overridden. In
order to ensure that the system works correctly, after catching an event in
the overridden <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aHandleWsEventL%28const%20TWsEvent%20%26amp%3b%2cCCoeControl%20%2a%29" format="application/java-archive"><parmname>HandleWsEventL()</parmname></xref> function the base class
implementation should be called. The event type is identified by <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/W32STD.HGlobals.html#%3a%3aTEventCode" format="application/java-archive"><parmname>TEventCode</parmname></xref>, which is a data member of the
window server event, <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/TWsEventClass.html#_top%20title=" format="application/java-archive"><parmname>TWsEvent</parmname></xref>. </p>
<codeblock id="GUID-C3C94D39-9BDF-4F89-9DEE-B1078A2AD04E" xml:space="preserve">void HandleWsEventL( const TWsEvent&amp; aEvent, CCoeControl* aDestination )
</codeblock>
<p> All the event types are defined in the <parmname>w32std.h</parmname> header.</p>
<p>Note that some event types are not implemented in the system or are
not available for third-party applications. All event codes from <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Window_Server/W32STD.HGlobals.html#%3a%3aTEventCode" format="application/java-archive"><parmname>TEventCode:EEventUser</parmname></xref> upwards can be used
for the application-specific events (discussed in <xref href="GUID-95DD1440-01C9-4997-8DD4-FFD33D7DEAFF.dita">Application-specific
events</xref>).
The following is a code example of the usage of a window server event:</p>
<codeblock id="GUID-CF247807-C0BF-4C84-B8DF-8C636F895043" xml:space="preserve">void CMyAppUi::HandleWsEventL( const TWsEvent&amp; aEvent,
                               CCoeControl* aDestination )
    {
    // Call the base class implementation
    CEikAppUi::HandleWsEventL( aEvent, aDestination );
    if( aEvent.Type() == EEventKeyDown )
        {
        // Do something
        iEikonEnv-&gt;InfoMsg( _L( “Key was pressed” ) );
        }
    }
</codeblock>
</conbody></concept>