Symbian3/SDK/Source/GUID-3729C075-4958-4874-9DD7-02A68D17E043.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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="GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90.dita#GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90/GUID-1ADF5125-A91A-3C5D-8422-50A84D7D6493"><apiname>CCoeAppUi::HandleWsEventL()</apiname></xref> function
of the UI controller object. To implement an event-handling code for a certain
event, <xref href="GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90.dita#GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90/GUID-1ADF5125-A91A-3C5D-8422-50A84D7D6493"><apiname>CCoeAppUi::HandleWsEventL()</apiname></xref> must be overridden.
To ensure that the system works correctly, after catching an event in the
overridden <xref href="GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90.dita#GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90/GUID-1ADF5125-A91A-3C5D-8422-50A84D7D6493"><apiname>CCoeAppUi::HandleWsEventL()</apiname></xref> function the base
class implementation should be called. The event type is identified by <parmname>TEventCode</parmname>,
which is a data member of the window server event, <parmname>TWsEvent</parmname>. </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>.</p>
<note>
<p>Some event types are not implemented in the system or are not available
for third-party applications. All event codes from <xref href="GUID-420348F5-4A82-3780-9D27-A3E1F4780F0B.dita#GUID-420348F5-4A82-3780-9D27-A3E1F4780F0B/GUID-5FADC321-7A9E-3CF6-B59F-D142E7A2EFF4"><apiname>TEventCode::EEventUser()</apiname></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>).</p>
</note>
<p> 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>