zoukankan      html  css  js  c++  java
  • How_to_Handle_Pointer_Events_in_a_Custom_Control(转)

    This page was last modified on 30 September 2009, at 06:05.

    ID...Creation date26.10.2008
    PlatformS60 5th EditionTested on devicesNokia 5800 XpressMusic.
    CategorySymbian C++SubcategoryTouch UI

    Keywords (APIs, classes, methods, functions): HandlePointerEventL(),Custom Control.

    Overview

    This snippet shows how to handle Pointer events in a custom control and route them to a proper component control by validating the pointer area against the control rect.

    This snippet can be self-signed.

    Preconditions

    Here we assume that we already have a working code for custom control, and we also assume that we have two components: iEdwin1 and iEdwin2 in a custom control.

    MMP file

    The following capabilities and libraries are required:

    CAPABILITY  None
     
    LIBRARY cone.lib

    #include <COECNTRL.H> 
     
    void CCustomContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
    {
    // Validate pointer position.
    if( iEdwin1->Rect().Contains( aPointerEvent.iPosition ) )
    {
    // click on edwin1 pass the pointer event. //
    iEdwin1->HandlePointerEventL( aPointerEvent );
    }
    else if( iEdwin2->Rect().Contains( aPointerEvent.iPosition ) )
    {
    // click on edwin2 pass the pointer event. //
    iEdwin2->HandlePointerEventL( aPointerEvent );
    }
    else
    {
    // simply calling the base class implementation //
    CCoeControl::HandlePointerEventL(aPointerEvent);
    }
    }

    Postconditions

    Pointer position will validated against the control rectangle and the pointer events will be routed to appropriate control.

  • 相关阅读:
    Linux内存初始化
    linux PCI设备初始化过程
    Linux网络地址转换分析
    Linux内核中流量控制
    IPSEC实现
    ip_conntrack 实现
    module_init宏解析
    IP隧道基础研究
    IPV6介绍
    Golang的接口
  • 原文地址:https://www.cnblogs.com/yaoliang11/p/1906473.html
Copyright © 2011-2022 走看看