×

Discussion Board

Results 1 to 6 of 6

Thread: Tabs issue

  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    55

    Tabs issue

    Hi,

    I want to create dynamic tabs in my application. I already have some screens, which has tabs and these screens are created by UI design. Now i want to maually add tabs to the same tab group that was created from ui design. And also i need to hav only one container view with multiple tabs. Below is my code.

    RESOURCE NAVI_DECORATOR r_application_navi_tabs1_resource
    {
    type = ENaviDecoratorControlTabGroup;
    control = TAB_GROUP
    {
    tab_width = EAknTabWidthWithTwoTabs; // two tabs
    active = 0;
    tabs =
    {
    TAB
    {
    id = ETabsSampleListBoxViewId;// created by UI
    txt = STR_tabsSampleApplication_5;
    },
    TAB
    {
    id = ETabsSampleContainerViewId;// added maunally
    txt = STR_tabsSampleApplication_6;
    },
    TAB
    {
    id = ETabsSampleContainerViewId;// added maunally
    txt = STR_tabsSampleApplication_7;
    },
    TAB
    {
    id = ETabsSampleContainerViewId;// added maunally
    txt = STR_tabsSampleApplication_8;
    },
    TAB
    {
    id = ETabsSampleContainerViewId;// added maunally
    txt = STR_tabsSampleApplication_9;
    },
    TAB
    {
    id = ETabsSampleContainerViewId;// added maunally
    txt = STR_tabsSampleApplication_10;
    }
    };
    };
    }
    // this method is defined by UI, (didn't modify anything)
    void CtabsSampleAppUi::InitializeContainersL()
    {

    CAknNavigationControlContainer* naviPane = ( CAknNavigationControlContainer* )
    StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );





    iNaviDecorator_ = naviPane->ResourceDecorator();
    if ( iNaviDecorator_ != NULL )
    {
    iNaviTabs1 = ( CAknTabGroup* ) iNaviDecorator_->DecoratedControl();

    }

    iTabsSampleListBoxView = CtabsSampleListBoxView::NewL();
    AddViewL( iTabsSampleListBoxView );
    SetDefaultViewL( *iTabsSampleListBoxView );
    SetActiveTabByViewId( iTabsSampleListBoxView->Id() );
    iTabsSampleContainerView = CtabsSampleContainerView::NewL();
    AddViewL( iTabsSampleContainerView );
    }


    // using the code below i m trying to display the tabs.
    //I have a listbox with items defined dynamically. now based on the items selected i m viewing one container class but // using different tabs.
    /**
    * Handle a command for this appui (override)
    * @param aCommand command id to be handled
    */
    void CtabsSampleAppUi::HandleCommandL( TInt aCommand )
    {
    // [[[ begin generated region: do not modify [Generated Code]
    /*TBool commandHandled = EFalse;
    switch ( aCommand )
    { // code to dispatch to the AppUi's menu and CBA commands is generated here
    default:
    break;
    }


    if ( !commandHandled )
    {
    if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
    {
    Exit();
    }
    }*/
    // ]]] end generated region [Generated Code]
    switch ( aCommand )
    { // code to dispatch to the AppUi's menu and CBA commands is generated here

    case ETabsSampleListBoxViewNextMenuItemCommand:
    {
    TInt index = static_cast<CtabsSampleDocument*> (CEikonEnv::Static ()->EikAppUi ()->Document ())->itemindex ;
    switch(index)
    {
    case 0:
    {
    iNaviTabs1->SetActiveTabByIndex(1);
    ActivateLocalViewL(TUid::Uid(ETabsSampleContainerViewId));
    break;
    }
    case 1:
    {

    iNaviTabs1->SetActiveTabByIndex(2);
    ActivateLocalViewL(TUid::Uid(ETabsSampleContainerViewId));
    break;
    }
    case 2:
    {

    iNaviTabs1->SetActiveTabByIndex(3);
    ActivateLocalViewL(TUid::Uid(ETabsSampleContainerViewId));
    break;
    }
    case 3:
    {
    iNaviTabs1->SetActiveTabByIndex(4);
    ActivateLocalViewL(TUid::Uid(ETabsSampleContainerViewId));
    break;
    }
    case 4:
    {
    iNaviTabs1->SetActiveTabByIndex(5);
    ActivateLocalViewL(TUid::Uid(ETabsSampleContainerViewId));
    break;
    }
    }
    }
    default:
    break;
    }

    }

    Now for me my tabs are created. But when i try to view my tabs, only my first tab is getting highlighted. If i m selecting say second or third item and i want to view the conatiner screen with two different tabs being displayed. i m not able to do so. For 1 sec , it tries to display tab2 or tab3 but then again it display comes back to tab1.

    Also i tried to create the whole tab group manaually(i.r with out using UI design). Then my above code works fine. But if i try to add the tabs to already created tabgroup i m facing this problem.
    Could anybody tell me whether wat i m doing is c orrect. Or is there any other way to do this. Plese help me.

    Thanks & regards
    ramanathan

  2. #2
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    62

    Re: Tabs issue

    HI ramanathan,

    To get Tab Highlighted for specific view, you have to activate that tab by using
    iTabGroup->SetActiveTabById (ETabsSampleListBoxViewId);
    before calling particular view.

    And to get Tab dynamically, you can create different Tab Group and accordingly you can call that resource.


    Ragini

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    55

    Re: Tabs issue

    Hi,

    Thanks for ur reply. I don't have clear idea of how to use two tab groups in the application. If u have some code snippet could u give me.

    And i m using SetActiveTabByIndex(), because i m assigning the same ID to the tabs i m creating. So i thought it won't display my tabs properly, if i use SetActiveTabById(). Please guide me if i m wrong.

    Thanks & regards
    ramanathan

  4. #4
    Regular Contributor
    Join Date
    Apr 2006
    Location
    India
    Posts
    383

    Re: Tabs issue

    Regards,
    Shilpa Kulkarni

  5. #5
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    55

    Re: Tabs issue

    Hi,

    I tried the code given in the link. Actually if i use different views then the codes work fine. But if i define all the tabs to one view it gives me the problem.
    So i want to know is there any possibility of defining multiple tabs to one view.

    Thanks & regards
    ramanathan

  6. #6
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    62

    Re: Tabs issue

    Hi ramanathan,

    Actually I didnt want to add more tabs so I make changes in rss file only
    made two tab groups for different view.

    like this:

    RESOURCE TAB_GROUP r_navigationpane2_tabgroup //for Navigation tab
    {
    tab_width = EAknTabWidthWithTwoTabs;//EAknTabWidthWithFourTabs; //EAknTabWidthWithTwoTabs; // display two tabs
    active = 0;

    tabs =
    {
    TAB
    {
    id = EMaintab1;
    txt = STRING_tab1_view;//
    }


    };
    }

    RESOURCE TAB_GROUP r_navigationpane1_tabgroup //for Navigation tab
    {
    tab_width = EAknTabWidthWithTwoTabs;//EAknTabWidthWithFourTabs; //EAknTabWidthWithTwoTabs; // display two tabs
    active = 0;

    tabs =
    {
    TAB
    {
    id = EMaintab1;
    txt = STRING_tab1_view;//
    },
    TAB
    {
    id = EMaintab2;
    txt = STRING_tab2_view;//
    }

    };
    }

    then in container when u call ur resource,
    you can call what way you want
    TResourceReader reader;
    if()
    iCoeEnv->CreateResourceReaderLC(reader, R_NAVIGATIONPANE1_TABGROUP);

    else
    iCoeEnv->CreateResourceReaderLC(reader, R_NAVIGATIONPANE2_TABGROUP);

    /////////////////////

    and why you use same TabId for different tabs?

    Ragini

Similar Threads

  1. Pointer Events Issue on Listbox and Tabs?
    By ilsocio in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-10-20, 07:17
  2. RTSP video streaming issue on 6280
    By olivier_irac in forum General Development Questions
    Replies: 0
    Last Post: 2006-12-04, 15:11
  3. Navigation Tabs (or Tabs Pane) in J2ME/Series 60
    By shadisky in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-05-05, 19:48
  4. Can't navigate tabs after adding list!!!
    By advocatee in forum Symbian
    Replies: 7
    Last Post: 2003-07-11, 09:13
  5. Re Display of Tabs
    By jimdeal in forum Symbian
    Replies: 1
    Last Post: 2003-06-20, 20:08

Posting Permissions

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