Datasheet
HANDLING INPUT FROM THE SCREEN 53
TRect rect1(TPoint(k1-offset), TPoint(k1+offset));
if (rect1.Contains(aPointerEvent.iPosition))
{
iKeyState | = KKey1;
return; // stored the event, so return
}
TPoint k2(width/2, height/2);
TRect rect2(TPoint(k2-offset), TPoint(k2+offset));
if (rect2.Contains(aPointerEvent.iPosition))
{
iKeyState | = KKey2;
return; // stored the event, so return
}
... // Other numbers similarly inspected
}
// Pointer events for other areas of the screen are ignored
// Pass them to the base class
CCoeControl::HandlePointerEventL(aPointerEvent);
}
Figure 2.2 illustrates the
Skeleton
example in the UIQ emulator. The
mouse is clicked and held on, or near, the ‘8’ digit to simulate a
tap and hold on the screen. The event is detected through CSkele-
tonUIQView::HandlePointerEventL() as shown above for digits
‘1’ and ‘2.’ The iKeyState member variable is updated to reflect the
screen event, and next time the game loop runs and the screen is updated,
the display for that digit highlights that the stylus is held to the screen.
When the stylus (or mouse click, in the case of the emulator) is released,
a pointer-up event is received and the highlight is removed.
Figure 2.2 Handling a pointer event received from a screen tap