Symbian3/SDK/Source/GUID-BD988DF9-45CA-53F3-816F-6DB81185CE40.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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-BD988DF9-45CA-53F3-816F-6DB81185CE40"><title>Control observers</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Each control may have an observer, typically another control, to which it can send events. An observer must: </p> <ul><li id="GUID-E3C3E0C7-3C33-59F1-9CF0-DC678D001A51"><p>implement the mixin class <xref href="GUID-A2BF9AE8-CF42-3D94-8763-66DB11EDDA46.dita"><apiname>MCoeControlObserver</apiname></xref> and </p> </li> <li id="GUID-1C882B62-4368-5118-A3CF-101A54FA5ED6"><p>be set as the observer for the control (or controls) it is to observe using <codeph>CCoeControl::SetObserver()</codeph>. </p> </li> </ul> <p>A control may have one observer only, but an observer may observe more than one control. </p> <p>A control sends an event to its observer using <codeph>CCoeControl::ReportEventL()</codeph>. The observer receives the event using <codeph>MCoeControlObserver::HandleControlEventL()</codeph>. Event types, which areĀ <i>not</i> the same as window server events, are defined by the <xref href="GUID-A2BF9AE8-CF42-3D94-8763-66DB11EDDA46.dita"><apiname>MCoeControlObserver</apiname></xref> enum <codeph>TCoeEvent</codeph>. </p> <p>A typical use of an observer is a <keyword>compound
        control</keyword> being the observer for its own components. The components send events to their compound control when they receive user input and the compound control manages the interaction between them. For example a control receiving a <codeph>TPointerEvent::EButton1Down</codeph> event sends an <codeph>MCoeControlObserver::EEventRequestFocus</codeph> event to its observer. This allows the observer to move focus between its components and to update their appearance. </p> </conbody></concept>