diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-33D93E96-98A9-4116-9028-3241D76A1036.dita --- a/Symbian3/SDK/Source/GUID-33D93E96-98A9-4116-9028-3241D76A1036.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-33D93E96-98A9-4116-9028-3241D76A1036.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,76 +1,70 @@ - - - - - -Enabling -additional touch events for your applicationThe Symbian platform provides additional touch events to enable -drag events using CCoeControl::EnableDragEvents()and -to specify screen areas for touch events. -

By default, the Symbian platform sends only EButton1Up and EButton1Down touch -events to applications.

-

If you want to enable EDrag touch events, implement CCoeControl::EnableDragEvents() in -your container class.

-

When the mobile device user drags the stylus on the screen, TPointerEvent::EDrag() events -are sent. When dragging stops, the application receives the event TPointerEvent::EButton1Up().

-void CTableauControl::ConstructL( const TRect& aRect ) - { - // This is parent window - CreateWindowL(); - - EnableDragEvents(); - - //SetRect( aRect ); - SetExtentToWholeScreen(); - - - // Initialize component array - InitComponentArrayL(); - - - //Implement your own logic here - ActivateL(); - } -

It is enough that the container control set EnableDragEvents() in -its construction. EnableDragEvents() need not be set again -for the child controls to receive dragging events.

-
Controlling -which control receives a touch event

Particularly when you are receiving -drag events it may be that an object in the window may be drawn by one control, -while the pointer is over another control. In cases where you want to ensure -that pointer events are received by the intended control, implement CCoeControl::SetPointerCapture().

When -a control receives a TPointerEvent::EButton1Down() event, -all events will be sent to this control until the next TPointerEvent::EButton1Up() event. -If you want to have events to be sent to another control before the TPointerEvent::EButton1Up() event, -call SetPointerCapture(ETrue) from the new control.

When -the new control has received its pointer event and TPointerEvent::EButton1Up() has -been received, you have to call SetPointerCapture(EFalse) from -the new control to stop events being sent to it indefinitely.

-
Specifying -screen areas for touch events

To specify screen areas (TRect) -for touch events, see the example below.

void CTableauControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - // Does the user point exit text on screen? - // iExitRect is rectangle of the text area on screen. - if (iExitRect.Contains(aPointerEvent.iPosition)) - { - if (iEikonEnv->QueryWinL(_L("Klondike"),_L("Exit?"))) - { - // Exit was pointed, then do exit - (static_cast<CKlondikeAppUi*>(iEikonEnv->AppUi()))->HandleCommandL(EEikCmdExit); - return; - } - } - ... - }
-
Ignoring events -other than pointer up in your control

In cases where you want to -make sure your control receives only touch EButton1Up events -after receiving a touch EButton1Down event, implement CCoeControl::IgnoreEventsUntilNextPointerUp().

+ + + + + +Enabling additional touch events for your applicationThe Symbian platform provides additional touch events to +enable drag events and to specify screen areas for touch events. +

By default, the Symbian platform sends only EButton1Up and EButton1Down touch events to applications.

+

If you want to enable EDrag touch events, +implement CCoeControl::EnableDragEvents() in your +container class.

+

When the mobile device user drags the stylus on the screen, TPointerEvent::EDrag() events are sent. When dragging stops, +the application receives the event TPointerEvent::EButton1Up().

+void CTableauControl::ConstructL( const TRect& aRect ) + { + // This is parent window + CreateWindowL(); + + EnableDragEvents(); + + SetRect( aRect ); + SetExtentToWholeScreen(); + + + // Initialize component array + InitComponentArrayL(); + + + //Implement your own logic here + ActivateL(); + } +

It is enough that the container control set EnableDragEvents() in its construction. EnableDragEvents() need not +be set again for the child controls to receive dragging events.

+
Controlling +which control receives a touch event

Particularly when you +are receiving drag events it may be that an object in the window may +be drawn by one control, while the pointer is over another control. +In cases where you want to ensure that pointer events are received +by the intended control, implement CCoeControl::SetPointerCapture().

When a control receives a TPointerEvent::EButton1Down() event, all events will be sent to this control until the next TPointerEvent::EButton1Up() event. If you want to have +events to be sent to another control before theTPointerEvent::EButton1Up() event, call SetPointerCapture(ETrue) from the new +control.

When the new control has received its pointer event +and TPointerEvent::EButton1Up() has been received, +you have to call SetPointerCapture(EFalse) from the +new control to stop events being sent to it indefinitely.

+
Specifying +screen areas for touch events

To specify screen areas (TRect) for touch events, see the example below.

void CTableauControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + // Does the user point exit text on screen? + // iExitRect is rectangle of the text area on screen. + if (iExitRect.Contains(aPointerEvent.iPosition)) + { + if (iEikonEnv->QueryWinL(_L("Klondike"),_L("Exit?"))) + { + // Exit was pointed, then do exit + (static_cast<CKlondikeAppUi*>(iEikonEnv->AppUi()))->HandleCommandL(EEikCmdExit); + return; + } + } + ... + }
+
Ignoring +events other than pointer up in your control

In cases where +you want to make sure your control receives only touch EButton1Up events after receiving a touch EButton1Down event, implement CCoeControl::IgnoreEventsUntilNextPointerUp().

\ No newline at end of file