×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    31

    OfferKeyEventL and Note Dialog

    Hello All,

    I have following problem

    In my OfferKeyEventL upon pressing Left Soft Key or Enter I call function which checks some condition and outputs a note dialog with the warning.

    The problem is
    Scenario 1
    1) I press left soft key.
    2) On Key event EEventKeyDown I call my function
    3) Check for condition and call note dialog
    4) Boom! Note dialog closes immediately because it captures either EEventKey or EEventKeyUp

    Scenario 2
    1) I press left soft key.
    2) On Key event EEventKeyUp I call my function
    3) Check for condition and call note dialog
    4) This time I can see Note. But when I confirm (press either left soft or enter) note dialog destroyed on EEventKeyDown and
    5) Boom! We again in the OfferKeyEventL and calling my function.
    Infinite loop!

    It looks to me that the only way to break this would be before displaying Note dialog - introduce a small delay (so Note dialog wouldn't catch EEventKeyUp ), but I don't like this approach.

    Would appreciate if someone has other ideas.

    Dmitry

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: OfferKeyEventL and Note Dialog

    Hello,
    have you got after each condition:
    Code:
    return EKeyWasConsumed;
    How do your condition looks like?
    Mine works fine if i have got it like this:
    Code:
    	if (aKeyEvent.iCode==EKeyUpArrow)
    		{
    		//do something
    		return EKeyWasConsumed;
    		}
    	if (aKeyEvent.iCode==EKeyDownArrow)
    		{
    		// do something
    		return EKeyWasConsumed;
    		}
    good luck

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    31

    Re: OfferKeyEventL and Note Dialog

    Hello,

    Mine look like this

    Code:
    if( aType == EEventKeyDown )
    		{
    		 
    		 switch(aKeyEvent.iScanCode)
    			 {
    			 //Left soft key
    			 case 164:
    				 {
    				  Selection(iModel);
    				  return EKeyWasConsumed;
    				 }
    				 break;
    			 case 167:
    				 {
    				  Selection(iModel);
    				  return EKeyWasConsumed;
    				 }
    				 break;
    And then in the Selection method I do this

    Code:
    if (iNetLost)
      {
    				 HBufC* message2 = StringLoader::LoadL(R_NETWORK_LOST);
    	  		     this->RunNoteDialog(message2);
    	  		     //this->RunNote1L(message2);
    	  			 delete message2;
      }

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: OfferKeyEventL and Note Dialog

    You launch the note on KeyDown, so the Key event is going to be forwarded to the note, probably causing it to close.
    Try what happens if you execute the note on EEventKey, or even EEventKeyUp.

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    31

    Re: OfferKeyEventL and Note Dialog

    Quote Originally Posted by wizard_hu_ View Post
    You launch the note on KeyDown, so the Key event is going to be forwarded to the note, probably causing it to close.
    Try what happens if you execute the note on EEventKey, or even EEventKeyUp.
    On EEventKeyUp - infinite loop, scenario 2
    On EEventKey - scenario 1

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    31

    Re: OfferKeyEventL and Note Dialog

    OK, I found workaround

    It's not what I would like, but it works

    I had to declare one TBool var in my Container class

    like this

    Code:
    TBool				iModelSelected;
    initialize it with EFalse in the Constructor

    and then in the OfferKeyEventL do this

    Code:
    if( aType == EEventKeyDown )
    {
      //if left soft key or enter pressed
     if ((aKeyEvent.iScanCode == 164) || (aKeyEvent.iScanCode == 167))
     {
       iModelSelected = ETrue;
       return EKeyWasConsumed;
     }
    }
    
    if( aType == EEventKeyUp )
     {
      if (iModelSelected)
       {
        ModelSelected(iModelId);
        iModelSelected = EFalse;
        return EKeyWasConsumed;
       }
     }

Similar Threads

  1. ExecuteLD in OfferKeyEventL
    By n-code in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-10-22, 15:20
  2. Never reaches OfferKeyEventL
    By kurtrips in forum Symbian
    Replies: 3
    Last Post: 2005-01-02, 13:19

Posting Permissions

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