Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2004

    How to show tabs on selected views


    My aplication has 4 views. I only want the tabs( 2 of them) show on the last 2 views, not on the first 2 views,

    Any one know how to do that?


  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Czech Republic

    so dont use resources. In DoActivate() and DoDeactivate()methods of the view construct tabs and display them. Using AppUi()->StatusPane() you get access to the status pane. It has method ControlL(), which returns you a CCoeControl derived object. The type of object you pass as parameter TUid (we pass EEikStatusPaneUidNavi). It returns back instance of CAknNavigationControlContainer class, which is something like container for placing a control to the navigantion pane (tabs, text,...). The controls are created by calling Create...() method of this container, where use instead of '... ' spoecified control name. So we will call CreateTabGroupL(), whcih creates a class CAknNavigationDecorator for holding a tabs (or any other control created on navigation pane). FINALLY we can access this control by calling DecoratedControl() method of decorator:

    CAknTabGroup* tabGroup = (CAknTabGroup*)iNaviPaneDecorator->DecoratedControl();
    tabGroup->AddTabL(0,_L("tab 1"));
    tabGroup->AddTabL(1,_L("tab 2"));

    The only thing we must do to display the navi tabs is calling CAknNavigationControlContainer::PushL(). The visibility of navi tabs is made by calling the MakeVisible() function of decorator. Deleting decorator is all you must done to free all allocated memory.

    When creating a decorator in one view the question should be hoiw access it in the second view. You can pass the decorator oas parameter or get poineter to it by calling:

    iNaviPaneDecorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top();

    It look quite ugly ye??

    Ok I to make my answer really complete I must say that there is one simillar way how to do this:

    CAknNavigationControlContainer* np= (CAknNavigationControlContainer*)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));

    TResourceReader reader;
    CAknNavigationDecorator* iNaviDecoratorForTabs = np->CreateTabGroupL(reader);
    CleanupStack::PopAndDestroy(); // resource reader

    CAknTabGroup* tabGroup =static_cast<CAknTabGroup*>(iDecoratedTabGroup->DecoratedControl());


    The only difference is usage of resources R_TAB_GROUP of TAB_GROUP type.

    The last one thing is about calling PushL() and Pop() methods of container. When you have views with tabs and you switch to another group of views wint other tabs you push new tabs to show them and when leaving you pop them back to show previous group of tabs:

    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
    CAknNavigationControlContainer* np= (CAknNavigationControlContainer*)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
    delete iDecoratedTabGroup;
    iDecoratedTabGroup = NULL;

    When you dont switch between two groups of tabs you dont need to pop.

    Bye STeN

Posting Permissions

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