×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    9

    Dynamic Creation of tabs

    I want to create all the tabs at run time. the code i am using is

    Code in Resource File is

    RESOURCE NAVI_DECORATOR r_multiviews_navi_decorator
    {
    type = ENaviDecoratorControlTabGroup;
    control = TAB_GROUP
    {
    tab_width = EAknTabWidthWithTwoLongTabs;
    active = 0;
    tabs = { };
    };
    }

    Code in AppUi.cpp File in ConstructL() function is

    CEikStatusPane* sp = StatusPane();
    iNaviPane = ( CAknNavigationControlContainer* )sp->ControlL(
    TUid::Uid( EEikStatusPaneUidNavi ) );
    iDecoratedTabGroup = iNaviPane->ResourceDecorator();
    if ( iDecoratedTabGroup )
    {
    iTabGroup = ( CAknTabGroup* ) iDecoratedTabGroup->DecoratedControl();
    }
    sp->SetDimmed(ETrue);

    for(TInt loop=1; loop<5; loop++)
    {
    buf.Copy(_L("Tab"));
    buf.AppendNum(loop);
    iTabGroup->AddTabL(loop,buf) ;
    }
    iTabGroup->SetActiveTabByIndex(1);


    The problem is that when application opens the tabs are created but the title of first tab is not showing, after going to second tab view and coming back to first tab view, the title comes up.

    Cud anyone suggest wat the trouble may be.
    Thanks in Advance.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    it is long time ago, I created tabs dynamically, I used such code:

    void CreateTabsL(CDesC16Array* aArray, TInt aWidth)
    {
    // get pointer to status pane
    CEikStatusPane* statusPane = StatusPane();

    // each panel has uid in avkon.hrh
    TUid uid;
    uid.iUid = EEikStatusPaneUidNavi;
    CAknNavigationDecorator* decorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top();

    if ( !decorator )
    {
    // container for navigation pane controls
    CAknNavigationControlContainer* container;
    //get pointer to navigation pane
    container = (CAknNavigationControlContainer*)statusPane->ControlL(uid);

    // decorator represetnts control which will be included into naviPaneContainer
    // create and return a new navigation decorator object containing tab group.
    decorator = container->CreateTabGroupL();

    // now we modify the tab group control by adding two tabs,
    // so pointer must be obtained
    CAknTabGroup* tabs = ( CAknTabGroup* )decorator->DecoratedControl();
    tabs->SetTabFixedWidthL( aWidth );

    for ( TInt i = 0; i < aArray->Count(); ++i )
    tabs->AddTabL( i, aArray->MdcaPoint( i ) );

    tabs->SetActiveTabByIndex( 0 );
    container->PushL( *decorator );
    };
    };

    Maybe helpfull for you...

    Bye
    STeN

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    9
    Thanx a lot.
    The code is now running perfectly fine. I just forgot to add iNaviPane->PushL( *iDecoratedTabGroup );

  4. #4
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: Dynamic Creation of tabs

    Quote Originally Posted by stenlik View Post
    Hi,

    it is long time ago, I created tabs dynamically, I used such code:

    void CreateTabsL(CDesC16Array* aArray, TInt aWidth)
    {
    // get pointer to status pane
    CEikStatusPane* statusPane = StatusPane();

    // each panel has uid in avkon.hrh
    TUid uid;
    uid.iUid = EEikStatusPaneUidNavi;
    CAknNavigationDecorator* decorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top();

    if ( !decorator )
    {
    // container for navigation pane controls
    CAknNavigationControlContainer* container;
    //get pointer to navigation pane
    container = (CAknNavigationControlContainer*)statusPane->ControlL(uid);

    // decorator represetnts control which will be included into naviPaneContainer
    // create and return a new navigation decorator object containing tab group.
    decorator = container->CreateTabGroupL();

    // now we modify the tab group control by adding two tabs,
    // so pointer must be obtained
    CAknTabGroup* tabs = ( CAknTabGroup* )decorator->DecoratedControl();
    tabs->SetTabFixedWidthL( aWidth );

    for ( TInt i = 0; i < aArray->Count(); ++i )
    tabs->AddTabL( i, aArray->MdcaPoint( i ) );

    tabs->SetActiveTabByIndex( 0 );
    container->PushL( *decorator );
    };
    };

    Maybe helpfull for you...

    Bye
    STeN
    when i try to execute this code
    i got an an error
    i.e
    illegal use of incomplete struct/union/class 'CAknNavigationDecorator'
    so how can i solve this problem
    thanks &regards
    arumilli

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Dynamic Creation of tabs

    "incomplete" means that the given entity has a forward declaration ("class CAknNavigationDecorator;"), but you have not #include-d its 'real' header file. Check it in the SDK Help.

  6. #6
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: Dynamic Creation of tabs

    Quote Originally Posted by wizard_hu_ View Post
    "incomplete" means that the given entity has a forward declaration ("class CAknNavigationDecorator;"), but you have not #include-d its 'real' header file. Check it in the SDK Help.
    thank u
    i included #include <aknnavi.h> for class CAknNavigationDecorator;
    still facing the same problem

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Dynamic Creation of tabs

    Which SDK do you use? Now I have checked 2nd, 2nd FP2 and 3rd MR. All of them writes something else than aknnavi.h

  8. #8
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: Dynamic Creation of tabs

    thank u,
    i am unable to change the tab
    whether i have to catch the key events on tabs or anything else.

Posting Permissions

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