×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: handle event of CBA button

    Ok so going by the link you need to handle the softkeys ok & cancel(which are drawn in customized manner). Rectangles for both the softkeys are defined & you need to handle the pointer event under those rectangles only(iSk1Rect & iSk2Rect) , so the code inside HandlePointerEventL() would be something like:

    void CYourclass::HandlePointerEventL(const TPointerEvent& aPointerEvent)
    {
    switch (aPointerEvent.iType)
    {
    case TPointerEvent::EButton1Down:
    {
    }
    break;
    case TPointerEvent::EButton1Up:
    {
    iClickCurrentPosition = aPointerEvent.iPosition; // TPoint iClickCurrentPosition (in header)
    if (iClickCurrentPosition.iX >=iSk1Rect .iTl.iX && iClickCurrentPosition.iY >=iSk1Rect .iTl.iY &&
    iClickCurrentPosition.iX <= iSk1Rect .iBr.iX && iClickCurrentPosition.iY <= iSk1Rect .iTl.iY)
    {
    // here the touch on button is detected
    }
    }
    }

  2. #17
    Registered User
    Join Date
    Nov 2011
    Posts
    136

    Re: handle event of CBA button

    thank you but that is not working properly ...if i add complete if condition you gave then it is not working,so i tried to with half condition , it worked but only "OK" key not for "CANCEL" ....if i click cancel then also i am getting "OK" key is Pressed..... actually on complete control pane if i click i am getting Prompt "OK" clicked....


    i have added this code...


    if i use complete line which you g


    case TPointerEvent::EButton1Up:
    {
    TPoint iClickCurrentPosition = aPointerEvent.iPosition; // TPoint iClickCurrentPosition (in header)
    if (iClickCurrentPosition.iX >=iSk1Rect .iTl.iX && iClickCurrentPosition.iY >=iSk1Rect .iTl.iY)
    {
    // here the touch on button is detected
    TBuf<50> aString1;
    aString1.Append(_L("ok key pressed"));
    TRequestStatus status = KRequestPending;
    CAknGlobalMsgQuery * pDlg = CAknGlobalMsgQuery::NewL();
    CleanupStack::PushL(pDlg);
    pDlg->ShowMsgQueryL(status, aString1,
    R_AVKON_SOFTKEYS_OK_EMPTY, _L("Mobi Security"),
    KNullDesC, 0, -1, CAknQueryDialog::EConfirmationTone);
    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy();
    }
    else if (iClickCurrentPosition.iX <= iSk2Rect .iBr.iX && iClickCurrentPosition.iY <= iSk2Rect .iTl.iY)
    {
    TBuf<50> aString1;
    aString1.Append(_L("cancel key pressed"));
    TRequestStatus status = KRequestPending;
    CAknGlobalMsgQuery * pDlg = CAknGlobalMsgQuery::NewL();
    CleanupStack::PushL(pDlg);
    pDlg->ShowMsgQueryL(status, aString1,
    R_AVKON_SOFTKEYS_OK_EMPTY, _L("Mobi Security"),
    KNullDesC, 0, -1, CAknQueryDialog::EConfirmationTone);
    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy();
    }
    Last edited by cholker; 2012-04-18 at 05:59.
    Regards,
    Cholker

  3. #18
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: handle event of CBA button

    Obviously you need to check your values in the if-else case.

  4. #19
    Registered User
    Join Date
    Nov 2011
    Posts
    136

    Re: handle event of CBA button

    Thanks for your help now it is working...

    i did as follows....


    switch (aPointerEvent.iType)
    {
    case TPointerEvent::EButton1Down:
    {
    }
    break;
    case TPointerEvent::EButton1Up:
    {
    TPoint iClickCurrentPosition = aPointerEvent.iPosition; // TPoint iClickCurrentPosition (in header)
    if (iClickCurrentPosition.iX <= iSk1Rect .iBr.iX
    && iClickCurrentPosition.iY >= iSk1Rect .iTl.iY)
    {
    // here the touch on button is detected
    TBuf<50> aString1;
    aString1.Append(_L("ok key pressed"));
    TRequestStatus status = KRequestPending;
    CAknGlobalMsgQuery * pDlg = CAknGlobalMsgQuery::NewL();
    CleanupStack::PushL(pDlg);
    pDlg->ShowMsgQueryL(status, aString1,
    R_AVKON_SOFTKEYS_OK_EMPTY, _L("Mobi Security"),
    KNullDesC, 0, -1, CAknQueryDialog::EConfirmationTone);
    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy();
    }
    if (iClickCurrentPosition.iX >= iSk2Rect .iTl.iX
    && iClickCurrentPosition.iY >= iSk2Rect .iTl.iY)
    {
    TBuf<50> aString1;
    aString1.Append(_L("cancel key pressed"));
    TRequestStatus status = KRequestPending;
    CAknGlobalMsgQuery * pDlg = CAknGlobalMsgQuery::NewL();
    CleanupStack::PushL(pDlg);
    pDlg->ShowMsgQueryL(status, aString1,
    R_AVKON_SOFTKEYS_OK_EMPTY, _L("Mobi Security"),
    KNullDesC, 0, -1, CAknQueryDialog::EConfirmationTone);
    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy();
    }

    }
    }
    Regards,
    Cholker

  5. #20
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: handle event of CBA button

    Ok, put back the complete condition inside if & else if & then debug to see the values of iClickCurrentPosition.iX, iSk1Rect .iTl.iX etc & see where it fails. Also it is mandatory to use the complete condition inside the if, otherwise the touch event will not get restricted to the rectangles of 'OK' & 'Cancel' keys.

    topleft(iT.iX, iT.iY)

    //// Touch area

    bottom right(iBr.iX, iBr.iY)

  6. #21
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: handle event of CBA button

    For this particular pointer event stuff you may find method TRect::Contains useful.

  7. #22
    Registered User
    Join Date
    Nov 2011
    Posts
    136

    Re: handle event of CBA button

    ok will try that, but i checked it is handling only that area...i clicked on complete screen but not getting any event...

    but still i will try what you have suggested...
    Regards,
    Cholker

Similar Threads

  1. Replies: 16
    Last Post: 2013-10-04, 13:09
  2. unable to handle button press event
    By tlr in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-04-08, 15:20
  3. How to handle navigation button down event
    By tlr in forum Symbian User Interface
    Replies: 12
    Last Post: 2009-04-02, 06:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×