×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    Can't navigate tabs after adding list!!!

    Hi everyone,

    I have 2 tabs.

    I added a list to the container in my first tab's view, things were fine until after i added the OfferKeyEventL function(below) to the container in the first view(to navigate the list ). After doing that i can't navigate between the 2 tabs:

    TKeyResponse CKevlistContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType )
    {
    if (aType != EEventKey)
    return EKeyWasNotConsumed;

    if(iListBox)
    {
    return iListBox->OfferKeyEventL(aKeyEvent, aType);
    }
    else
    {
    return EKeyWasNotConsumed;
    }
    }

    --------------------------------------------------------------------
    Navigation between tabs is done by appui:


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

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

    switch ( aKeyEvent.iCode )
    {
    case EKeyLeftArrow:
    if ( active > 0 )
    {
    active--;
    iTabGroup->SetActiveTabByIndex( active );
    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
    }
    break;
    case EKeyRightArrow:
    if( (active + 1) < count )
    {
    active++;
    iTabGroup->SetActiveTabByIndex( active );
    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
    }
    break;
    default:
    return EKeyWasNotConsumed;
    break;
    }

    return EKeyWasConsumed;
    }

    My tabs were created in the .rss file by having a custom
    RESOURCE STATUS_PANE_APP_MODEL and etc etc.

    Is there some conflict going on? Thanks...

    -advo-

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    Hi

    Might be better if you would implement the tabs in the same container as your listbox is. Then at least you wouldn't have any conflict between them. I quess for some reason the listbox return KeyUsed for left&Right, so the application framework won't give them to AppUi's key-function.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    50
    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).

  4. #4
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    hmm

    yucca,

    Yea i guess it would work that way, since another example in the SDK does it by putting all the codes within a container rather than spreading it out to the AppUI. Funny thing is, the pdf called "Designing C++ Applications for Series 60" page 26 says that:

    'If the container or one of iuts components does not consume the event, it will be passed on to the next item on the control stack'.

    It also says

    'The listbox is interested in key events as it consumes Up, Down, and OK Keys'.

    No mention about left and right keys.....

    Maybe AppUI is not on the control stack? Or maybe its becoz i'm using CKevlistAppUi::HandleKeyEventL instead of CKevlistAppUi::OfferKeyEventL. I tried the latter, and it didn't work.

    btw, is AppUI classified as a control?

    -advo-

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    Hi

    Beats me really, I think that calling BaseConstructL(), should also put the AppUI to the stack and then it should get all the events it's supposed to get.

    HandleKeyEventL() should be just fine and it really should get all the keyevents, so only thing that I can think is that for some reason some object is taking the left/right events before they would be passed to AppUi.

    jukka

  6. #6
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    implement the tabs in the same container as your listbox is

    yucca,

    How do i go about 'implementing the tabs in the same container as the listbox'..

    Im not having a problem with coding, but I just can't picture it.

    Lets say i follow your idea of implementing the tabs in the containers.

    lets say i need 3 tabs. Does that necessarily mean that i must have 3 views and 3 containers? Which container is going to own the tabgroup then?

    Or can i just implement 1 view with 1 container, but i change to a different listbox in the container whenever i move to a different tab... this sounds better. but..

    I'm not sure which is the best solution

    stressed,
    -advo-

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    Hi

    One view should be enough always. The rest depends on your solution requirements, sometimes you propably need to have as many controls (or containers) used in side your tab owning control as tabs. Then you just return right pointer in your ComponentControl()-function accordingly.

    But indeed if all of the tabs are showing similar control (such as listbox) the you could also just put new iconarray & text array to the list box and call DrawNow() to re-fresh the screen

    in the end it's up to you to deside.

    yucca

  8. #8
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    solution!

    I found a solution to allow the appui to control tab movements yet allow the container to implement OfferKeyEventL for the list.

    I have exactly the same code as my first post in the AppUI,
    but i changed the container's OfferKeyEventL's codes to this:

    if(aType != EEventKey)
    {
    User::InfoPrint(_L("aType != EEventKey"));
    return EKeyWasNotConsumed;
    }

    TChar charCode(aKeyEvent.iCode);
    switch (charCode)
    {

    case EKeyLeftArrow: // Left key.
    case EKeyRightArrow:
    User::InfoPrint(_L("Left and Right"));
    return EKeyWasNotConsumed;
    break;
    default:
    break;
    }

    if (iListBox)
    {
    User::InfoPrint(_L("iListBox->OfferKeyEventL"));
    return iListBox->OfferKeyEventL(aKeyEvent, aType);
    }
    else
    {
    User::InfoPrint(_L("Else EKeyWasNotConsumed"));
    return EKeyWasNotConsumed;
    }


    I think that u have to manually capture the left and right key events, and return a "EKeyWasNotConsumed", so that they are not passed to iListBox->OfferKeyEventL. Therefore they are then passed to the AppUI to handle the tabs.

    From what i observe, i think that

    iListBox->OfferKeyEventL

    will return a EKeyWasConsumed eventhough they are EKeyLeftArrow and EKeyRightArrowkey events.

    :P

    -advo-

Posting Permissions

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