×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Mumbai. India.
    Posts
    204

    Key event is not working

    Hi,

    I have one list shown in a container. I'm overriding OfferKeyEventL() also. But still none of the arrow key event is working.

    Code is as follows:

    HTML Code:
    [CODE]
    TKeyResponse CMyContainer2::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
        {
    	// See if we have a selection
        TInt code = aKeyEvent.iCode;
        switch(code)
            {
    	// is navigator button pressed
            case EKeyOK:
                iAppEngine->LaunchCurrent(iPhotoListBox->CurrentItemIndex());
                return (EKeyWasConsumed);
                break;
    
            default:
                // Let Listbox take care of its key handling
                return iPhotoListBox->OfferKeyEventL(aKeyEvent, aType);
                break;
            }
           return iPhotoListBox->OfferKeyEventL(aKeyEvent, aType);
    
         } 
    
    [/CODE]

    What could be the problem.
    Pankaj
    Mumbai.

  2. #2
    Super Contributor
    Join Date
    Aug 2005
    Location
    india
    Posts
    2,078

    Re: Key event is not working

    hi,

    Try this

    TKeyResponse CBackLightAppUi::HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
    {
    if ( iTabGroup == NULL )
    {
    return EKeyWasNotConsumed;
    }

    TInt active = iTabGroup->ActiveTabIndex();
    TInt count = iTabGroup->TabCount();

    switch ( aKeyEvent.iCode )
    {
    case EKeyLeftArrow:
    //do something
    break;
    case EKeyRightArrow:
    //do something
    break;
    default:
    return EKeyWasNotConsumed;
    break;
    }

    return EKeyWasConsumed;
    }

    Regards,
    Mateen Maldar
    "Whatever the mind can conceive and believe, the mind can achieve"

  3. #3
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Mumbai. India.
    Posts
    204

    Re: Key event is not working

    Hi mateen,

    Problem is like, I have two views. In first view I'm showing a list. On selection of first item from this list I'm switching to next view which contain another list. Now the OfferKeyEventL is working fine in a first list, but not working in second list. Why it is so?

    Or somewhere am I doing any mistaque?

    As you are saying in HandleKeyEvent I need to programm each and every thing. But in OfferKey event I don't need to increment the selected item position.

    Have any solution?
    Pankaj
    Mumbai.

  4. #4
    Super Contributor
    Join Date
    Aug 2005
    Location
    india
    Posts
    2,078

    Re: Key event is not working

    hi,
    pankaj

    AFAIk u r not properly implementing the OfferkeyEventL Try to debug at this function and let us know ur able to point ur debug position in this function.

    an paste the part of header and ur cpp so that we can know wht is happening inside ur code.

    Regards,
    Mateen Maldar
    "Whatever the mind can conceive and believe, the mind can achieve"

  5. #5
    Regular Contributor
    Join Date
    May 2005
    Location
    Brasov, Romania
    Posts
    431

    Re: Key event is not working

    Do you add that container to stack before implementing OfferKeyEvent?

    If a control wishes to process key events, it should implement this function. The implementation must ensure that the function returns EKeyWasNotConsumed if it does not do anything in response to a key event, otherwise, other controls or dialogs may be prevented from receiving the key event. If it is able to process the event it should return EKeyWasConsumed.

    When a key event occurs, the control framework calls this function for each control on the control stack, until one of them can process the key event (and returns EKeyWasConsumed).

    Each keyboard key press results in three separate events: EEventKeyDown, EEventKey, and EEventKeyUp, in that order.

    To receive key events, which can be processed by this function, the application should call CCoeAppUi::AddToStackL() to add the control to the stack. This only applies, however, to controls which are not components of a compound control. Compound controls should pass key events to their components as necessary: the components themselves do not go on the stack.

  6. #6
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Mumbai. India.
    Posts
    204

    Re: Key event is not working

    Hi iulian_moldovan,

    Thanks. I forgot to add the container to stack.

    I think I made such mistaque eairlier also, but I couldn't find it. Now I will keep in mind .

    Thank you once again.
    Pankaj
    Mumbai.

Similar Threads

  1. Key event problem
    By ZeeMoo in forum Symbian
    Replies: 5
    Last Post: 2006-05-18, 17:05
  2. Replies: 8
    Last Post: 2003-07-11, 12:56
  3. Key Event Issues
    By mykes in forum Symbian
    Replies: 0
    Last Post: 2003-05-01, 10:55
  4. Key event not working in 7650 simulator
    By shahzad73 in forum PersonalJava
    Replies: 1
    Last Post: 2002-12-18, 21:38
  5. Key event not working in 7650 simulator
    By hillcast1 in forum Mobile Java General
    Replies: 1
    Last Post: 2002-12-15, 14:47

Posting Permissions

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