×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    how to handle LSK & RSK(CBA)?

    Hello all,

    I wanted to get events when user clicks on LSK or RSK & on that do some action.
    I tried in offerkeyevetL() method using aKeyEvent.iScanCode ==EStdKeyDevice0 but although i am consuming it keys got send to menu.

    say for example i am displaying one dialog windows based on selecting menu option after that i dismissed it on LSK & restored original CBA.. still menu is open

    what shld i do? Any other way to handle CBA?

    plz help me out..

    thanks,
    bnvaikos

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: how to handle LSK & RSK(CBA)?

    Set the LSK to something custom, and do not use CBA that has options on the left side..

  3. #3
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to handle LSK & RSK(CBA)?

    Quote Originally Posted by symbianyucca View Post
    Set the LSK to something custom, and do not use CBA that has options on the left side..

    thanks for the reply..
    but where shld i handled events?
    when i click on LSK or RSK --based on that i have to call observer functions.

    thanks
    bnvaikos
    Last edited by bnvaikos; 2009-07-23 at 11:34.

  4. #4
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: how to handle LSK & RSK(CBA)?

    You can handle keypress events (LSK and RSK too ) by using YourAppUi::HandleKeyEventL() or YourControl::OfferKeyEventL()

  5. #5
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to handle LSK & RSK(CBA)?

    Quote Originally Posted by A.A.M. View Post
    You can handle keypress events (LSK and RSK too ) by using YourAppUi::HandleKeyEventL() or YourControl::OfferKeyEventL()
    I have handled it in my OfferKeyEventL method for ex a control is having ok/Cancel key.
    After clicking on cancel I am destroying that control & restoring original cba option exit. Although I have consumed key in offerkeyeventL still events are getting passed to Exit & my application exists.
    how to solve this problem? Could u plz provide me any other way?

    thanks
    bnvaikos

  6. #6
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: how to handle LSK & RSK(CBA)?

    Try to return EKeyWasConsumed after handling keypress by control.

  7. #7
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to handle LSK & RSK(CBA)?

    Quote Originally Posted by A.A.M. View Post
    Try to return EKeyWasConsumed after handling keypress by control.
    you are saying in offerkeyeventl... right?
    if it so i did that
    still exit RSK gets event

  8. #8
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: how to handle LSK & RSK(CBA)?

    you are saying in offerkeyeventl... right?
    Yes.

    Can you show your YourAppUi::HandleKeyEventL() and YourControl::OfferKeyEventL()?

  9. #9
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to handle LSK & RSK(CBA)?

    Quote Originally Posted by A.A.M. View Post
    Yes.

    Can you show your YourAppUi::HandleKeyEventL() and YourControl::OfferKeyEventL()?
    here my control is window owning & is added on stack after creation.
    i have not implemented YourAppUi::HandleKeyEventL().


    TKeyResponse CMyControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
    {
    TKeyResponse resp = EKeyWasConsumed;
    if ( aType != EEventKey && iButtonType == ENoButton) // Is not key event?
    {
    resp = EKeyWasNotConsumed;
    }
    // else if(aType == EEventKey && aKeyEvent.iCode == EKeyOK)
    // {
    // ProcessCmdL();
    //// resp = EKeyWasConsumed;
    // }
    //// else if( aType == EEventKeyDown && aKeyEvent.iScanCode ==EStdKeyDevice0)// left key selected
    //// {
    //// if(iCBAEventObserver)
    //// {
    //// iCBAEventObserver->OnLeftButtonSelection(iButtonType);
    ////// resp = EKeyWasConsumed;
    //// }
    //// }
    // else if(aKeyEvent.iScanCode ==EStdKeyDevice1)// right key selected
    // {
    //// if(iCBAEventObserver)
    //// {
    //// iCBAEventObserver->OnRightButtonSelection(iButtonType);
    //// resp = EKeyWasConsumed;
    //// }
    // }
    // else
    // {
    //// ProcessCmdL(); // handle left button selection
    // }
    return resp;
    }


    as you see i wanted to call iCBAEventObserver->OnLeftButtonSelection(iButtonType);
    observer method with the type of button m using it may be ok/empty...empty/cancel or ok/cancel

  10. #10
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: how to handle LSK & RSK(CBA)?

    Try to do like this:
    Code:
    TKeyResponse CMyControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
        {
        TKeyResponse ret = EKeyWasNotConsumed;
        
        if (aType == EEventKeyDown)
                {
                switch (aKeyEvent.iScanCode)
                    {
                    case EStdKeyDevice0: // Left SoftKey
                        {
                        ...
                        ret = EKeyWasConsumed;
                        break;
                        }
                    case EStdKeyDevice1: // Right SoftKey
                        {
                        ...
                        ret = EKeyWasConsumed;
                        break;
                        }
                    default:
                        {
                        break;
                        }
                    }
                }
        
        return ret;
        }

  11. #11
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to handle LSK & RSK(CBA)?

    Quote Originally Posted by A.A.M. View Post
    Try to do like this:
    Code:
    TKeyResponse CMyControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
        {
        TKeyResponse ret = EKeyWasNotConsumed;
        
        if (aType == EEventKeyDown)
                {
                switch (aKeyEvent.iScanCode)
                    {
                    case EStdKeyDevice0: // Left SoftKey
                        {
                        ...
                        ret = EKeyWasConsumed;
                        break;
                        }
                    case EStdKeyDevice1: // Right SoftKey
                        {
                        ...
                        ret = EKeyWasConsumed;
                        break;
                        }
                    default:
                        {
                        break;
                        }
                    }
                }
        
        return ret;
        }
    still facing same problem :(

    CMyControl::~CMyControl()
    {
    this->iCoeEnv->AppUi()->RemoveFromStack(this);
    if(iCurrentcba)
    {
    iCurrentcba->SetCommandSetL(iResourceIdForCBAWhenDialogExits );
    iCurrentcba->DrawNow();
    }
    }

    for ur referance
    after deleting control i am restoring cba

  12. #12
    Registered User
    Join Date
    Jul 2007
    Posts
    111

    Re: how to handle LSK & RSK(CBA)?

    Hi,

    I have similar problem, I need to catch EStdKeyDevice0 in CAknTextQueryDialog - Its done. But when I catch EStdKeyDevice0 in CAknTextQueryDialog Its also show menu options. I have custom CBA - Options and Contacts.

    I can not catch any key in AppUi (I try to debuging), i think its done be system.

    My code:

    Code:
    TKeyResponse CCAknPhoneNumberQueryDialog::OfferKeyEventL(
    		const TKeyEvent& aKeyEvent, TEventCode aType)
    	{
    	if(aKeyEvent.iScanCode == EStdKeyDevice0)
    		{		
    		iRateToCheck = ETrue;
    		DismissQueryL();
    		
    		return EKeyWasConsumed;
    		}
    	
    	else if (aKeyEvent.iCode == EKeyYes)
    		{	
    		iRateToCheck = EFalse;
    		DismissQueryL();
    		return EKeyWasConsumed;
    		}
    
    	else if (aKeyEvent.iCode == EKeyNo)
    		{
    		iRateToCheck = EFalse;
    		delete this;	
    		return EKeyWasConsumed;
    		}
    
    	return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent, aType);
    	}
    Big thanks for any help.

Similar Threads

  1. N95 returns SERVICE_SEARCH_NO_RECORDS
    By woppa in forum Bluetooth Technology
    Replies: 6
    Last Post: 2009-02-21, 16:17
  2. Regarding EEventKey for LSK and RSK
    By kkrish in forum Symbian User Interface
    Replies: 5
    Last Post: 2008-10-12, 10:30
  3. Replies: 0
    Last Post: 2006-12-26, 12:35
  4. Handle and kernel object
    By xhsoldier in forum Symbian
    Replies: 1
    Last Post: 2006-09-26, 08:09
  5. D211CTL.EXE Handle counts increases
    By lkussy in forum Multimodecards
    Replies: 0
    Last Post: 2004-01-15, 09:52

Posting Permissions

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