×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    Quote Originally Posted by vineet.jain View Post
    As said before also, custom tab is just a combination of images drawn together from an array, so if you are not drawing(you can also notice the Draw() method of that wiki code, only images are drawn) those images then no 'tab' would be there. For the time being you can simple take any image & utilize in the code.
    Ok I understand this. I just think the article has limited explanation. Like right now most of the errors I'm getting are library related. I keep discovering that I'm missing different libraries.

    like for now I just discovered that I needed the 'bafl.lib' lib for this error:"undefined reference to `CDesC16ArrayFlat::CDesC16ArrayFlat(int)'" ... these errors can be very time consuming for us beginners if we don't know whats causing them. at-least if the article can mention the needed libs then it will make it easier for the others to avoid such issues. Hence a working example would most likely eradicate any potential errors and misunderstandings.

    and also judging from searching on related topic it is very clear that a lot of developers have had issues trying to implement this 'example' without an actual functional example.
    Why is it then that an example hasn't been created by now? (please not I'm not sure if this is the write place to raise this concern. please forgive me if its not the right place.
    But so far I really appreciate your help [not to forget Wizard, his also been great help ]

  2. #17
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Limited number of Tabs

    That completely depends on the article creator as up-to what extent the details about the code implemented are provided. If anyone(even you too) feels that something is missing from the article & adding that missing factor would make the article more appropriate or useful then feel free to edit it.

  3. #18
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    Hi my app now builds without errors: except when I now call the 'CreateAndShowTabL() function in the constructor.

    I get the following error: "/Symbian/9.2/S60_3rd_FP1/EPOC32/include/e32base.inl:1223: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined."

    How do I resolve this?

  4. #19
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Limited number of Tabs

    you shouldn't be calling this from the constructor , ConstructL() is the right place to call from.Also i can see that customtabcontrol.h has the definition of constructor instead of being in cpp & you must be calling CreateAndShowTabL() from there only which i think is causing problem.

    Basically this comes up when there's a forward declaration of some class instead of including its header in the cpp.

  5. #20
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    yes that's were I'm calling it from 'ConstructL()' . I'm not sure what you mean from your next statement: "customtabcontrol.h has the definition of constructor instead of being in cpp "?

    which header could I be missing in my cpp?
    Last edited by KnowledgeSeeker; 2012-12-19 at 06:00.

  6. #21
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Limited number of Tabs

    can you paste here the header & cpp of the class which you implemented.

  7. #22
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    Quote Originally Posted by vineet.jain View Post
    can you paste here the header & cpp of the class which you implemented.
    header
    /*
    * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
    * All rights reserved.
    * This component and the accompanying materials are made available
    * under the terms of "Eclipse Public License v1.0"
    * which accompanies this distribution, and is available
    * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    *
    * Initial Contributors:
    * Nokia Corporation - initial contribution.
    *
    * Contributors:
    *
    * Description: Declares UI class for application
    *
    */


    #ifndef MYVIEWAPPUI_H
    #define MYVIEWAPPUI_H

    // INCLUDES
    #include <eikapp.h>
    #include <eikdoc.h>
    #include <e32std.h>
    #include <coeccntx.h>
    #include <aknviewappui.h> // View AppUi adds View handling to AppUi
    #include <akntabgrp.h> // For handling tabs
    #include <aknnavide.h>
    #include "CustomTabControl.h"

    // FORWARD DECLARATIONS
    class CMyViewView;
    class CMyViewView2;
    class CMyViewView3;
    class CMyViewView4;
    // CLASS DECLARATION

    /**
    * Application UI class. CAknViewAppUi derives from CAknAppUi and has view handling methods added.
    * Provides support for the following features:
    * - EIKON control architecture
    * - view architecture
    * - status pane
    *
    */
    class CMyViewAppUi : public CAknViewAppUi
    {
    public: // // Constructors and destructor

    /**
    * EPOC default constructor.
    */
    void ConstructL();

    /**
    * Destructor.
    */
    ~CMyViewAppUi();







    private:
    // From MEikMenuObserver
    // With this, we can dynamically manipulate menu items.
    void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);

    private:
    /**
    * From CEikAppUi, takes care of command handling.
    * @param aCommand command to be handled
    */
    void HandleCommandL(TInt aCommand);


    /**
    * From CEikAppUi, handles key events.
    * @param aKeyEvent Event to handled.
    * @param aType Type of the key event.
    * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed).
    */
    virtual TKeyResponse HandleKeyEventL(
    const TKeyEvent& aKeyEvent,TEventCode aType);

    void HandleForegroundEventL(TBool aForeground);

    /**
    * From CEikAppUi, handles key events.
    * @param aType The type of resources that have changed
    */
    virtual void HandleResourceChangeL( TInt aType );

    public:

    void CreateAndShowTabsL();
    private: //Data
    CAknNavigationControlContainer* iNaviPane;
    //CAknTabGroup* iTabGroup;
    CCustomTabControl* iTabGroup;
    CAknNavigationDecorator* iDecoratedTabGroup;
    TUid iViewId1;
    TUid iViewId2;
    TUid iViewId3;
    TUid iViewId4;
    };

    #endif

    // End of File
    .........

  8. #23
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    source part1
    Code:
    // INCLUDE FILES
    #include "MyViewAppUi.h"
    #include "MyViewView.h"
    #include "MyViewView2.h"
    #include "MyViewView3.h"
    #include "MyViewView4.h"
    #include <MyView.rsg>
    #include "myview.hrh"
    #include "MSVSTD.HRH"
    #include <avkon.hrh>
    #include "CustomTabControl.h"
    #include <MyView.mbg>
    #include <akniconarray.h>
    
    
    
    
    // ================= MEMBER FUNCTIONS =======================
    //
    // ----------------------------------------------------------
    // CMyViewAppUi::ConstructL()
    // ----------------------------------------------------------
    //
    void CMyViewAppUi::ConstructL()
        {
        //Initialises this app UI with standard values.
        //The application’s standard resource file will be read unless
        //the ENoAppResourceFile or ENonStandardResourceFile flags are passed.
        BaseConstructL(0x08 | EAknEnableSkin); // Use ELayoutAwareAppFlag (0x08) to make the application support scalable UI on FP3 devices.
    
    
        // Show tabs for main views from resources
        CEikStatusPane* sp = StatusPane();
    
        // Fetch pointer to the default navi pane control
        iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
            TUid::Uid(EEikStatusPaneUidNavi));
        
        
        	//CMyViewAppUi::CreateAndTabsL();
        CreateAndShowTabsL();
    
        // Tabgroup has been read from resource and it was pushed to the navi pane.
        // Get pointer to the navigation decorator with the ResourceDecorator() function.
        // Application owns the decorator and it has responsibility to delete the object.
       //-- iDecoratedTabGroup = iNaviPane->ResourceDecorator();
       //-- if (iDecoratedTabGroup)
        //--    {
       //--  iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
        //--    }
        
       
        
        CMyViewView* view1 = new (ELeave) CMyViewView;
    
        CleanupStack::PushL( view1 );
        //--view1->ConstructL(iTabGroup);
        
       
        AddViewL( view1 );        // transfer ownership to CAknViewAppUi
        CleanupStack::Pop( view1 );
       iViewId1 = view1->Id();   // view id to get view from CAknViewAppUi
    
    
        CMyViewView2* view2 = new (ELeave) CMyViewView2;
    
        CleanupStack::PushL( view2 );
        view2->ConstructL();
        AddViewL( view2 );      // transfer ownership to CAknViewAppUi
        CleanupStack::Pop( view2 );
        iViewId2 = view2->Id(); // view id to get view from CAknViewAppUi
        
        CMyViewView3* view3 = new (ELeave) CMyViewView3;
    
            CleanupStack::PushL( view3 );
            view3->ConstructL();
            AddViewL( view3 );      // transfer ownership to CAknViewAppUi
            CleanupStack::Pop( view3 );
            iViewId3 = view3->Id(); // view id to get view from CAknViewAppUi
            
            CMyViewView4* view4 = new (ELeave) CMyViewView4;
    
                    CleanupStack::PushL( view4 );
                    view4->ConstructL();
                    AddViewL( view4 );      // transfer ownership to CAknViewAppUi
                    CleanupStack::Pop( view4 );
                    iViewId4 = view4->Id(); // view id to get view from CAknViewAppUi
    
    
        SetDefaultViewL( *view1 );
        }
    
    // ----------------------------------------------------
    // CMyViewAppUi::~CMyViewAppUi()
    // Destructor
    // Frees reserved resources
    // ----------------------------------------------------
    //

  9. #24
    Registered User
    Join Date
    Jul 2012
    Posts
    30

    Re: Limited number of Tabs

    source part2

    Code:
    CMyViewAppUi::~CMyViewAppUi()
        {
        delete iDecoratedTabGroup;
        }
    
    // ------------------------------------------------------------------------------
    // CMyViewAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
    //  This function is called by the EIKON framework just before it displays
    //  a menu pane. Its default implementation is empty, and by overriding it,
    //  the application can set the state of menu items dynamically according
    //  to the state of application data.
    // ------------------------------------------------------------------------------
    //
    void CMyViewAppUi::DynInitMenuPaneL(
        TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
        {
        }
    
    
    // ------------------------------------------------------------------------------
    // CMyViewAppUi::HandleForegroundEventL(TBool aForeground)
    //  This function is called by the  framework when the screen loses or gains focus.
    //   i.e. when it goes to the background or to the foreground. Incoming call
    //   softnote is an example.
    // This event applies to the entire application, all views.
    // ------------------------------------------------------------------------------
    //
    void CMyViewAppUi::HandleForegroundEventL(TBool aForeground)
        {
        if (aForeground==TRUE)
        iEikonEnv->InfoMsg(_L("Foreground true"));
        else
        iEikonEnv->InfoMsg(_L("Foreground false"));
    
        }
    
    
    
    // ----------------------------------------------------
    // CMyViewAppUi::HandleKeyEventL(
    //     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
    // Here we handle key events: Right and left arrow key
    //   to change view.
    // ----------------------------------------------------
    //custom
    TKeyResponse CMyViewAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
    {
    
    if ( iTabGroup == NULL )
    {
    	return EKeyWasNotConsumed;
    }
    
    if(iTabGroup->IsFocused())
    {
    	TInt active = iTabGroup->ActiveTabIndex();
    	TInt count = iTabGroup->TabCount();
    
    
    	switch ( aKeyEvent.iCode )
    	{
    	case EKeyLeftArrow:
    		if ( active > 0 )
    		{
    		active--;
    		ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)+1));
    		}
    		else
    		{
    		active=count-1;
    		ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)+1));
    		}
    	return EKeyWasConsumed;
    	case EKeyRightArrow:
    		if( (active + 1) < count )
    		{
    		active++;
    		ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)+1));
    		}
    		else
    		{
    		active=0;
    		ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)+1));
    		} 
    		return EKeyWasConsumed;
    	default:
    		return EKeyWasNotConsumed;
    	}
    }
    
    return EKeyWasNotConsumed;
    }
    
    /*TKeyResponse CMyViewAppUi::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() is used to change the view.
                    // To change view from another application we would use ActivateViewL()
                    // Send an empty message
                    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
                    }
                break;
            case EKeyRightArrow:
                if( (active + 1) < count )
                    {
                    active++;
                    iTabGroup->SetActiveTabByIndex( active );
                    // ActivateLocalViewL() is used to change the view.
                    // To change view from another application we would use ActivateViewL()
                    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
                    }
                break;
            default:
                return EKeyWasNotConsumed;
            }
    
        return EKeyWasConsumed;
        }*/
    
    // ----------------------------------------------------
    // CMyViewAppUi::HandleCommandL(TInt aCommand)
    // Here we handle commands on the application level.
    // In addition, each view has their own HandleCommandL()
    // ----------------------------------------------------
    //
    void CMyViewAppUi::HandleCommandL(TInt aCommand)
        {
        switch ( aCommand )
            {
            case EEikCmdExit:
                {
                Exit();
                break;
                }
            // You can add your all application applying commands here.
            // You would handle here menu commands that are valid for all views.
            }
        }
    
    // -----------------------------------------------------------------------------
    // CChatAppUi::HandleResourceChangeL( TInt aType )
    // Called by framework when layout is changed.
    // -----------------------------------------------------------------------------
    //
    void CMyViewAppUi::HandleResourceChangeL( TInt aType )
        {
        CAknAppUi::HandleResourceChangeL( aType );
    
        // ADDED FOR SCALABLE UI SUPPORT
        // *****************************
        if ( aType==KEikDynamicLayoutVariantSwitch )
            {
    		((CMyViewView*) View( iViewId1) )->HandleClientRectChange(  );
    		((CMyViewView2*) View( iViewId2) )->HandleClientRectChange(  );
    		((CMyViewView3*) View( iViewId3) )->HandleClientRectChange(  );
    		((CMyViewView4*) View( iViewId4) )->HandleClientRectChange(  );
    		}
    
        }
    
    void CMyViewAppUi::CreateAndShowTabsL()
     {
     ///// custom tab construction
     TRect tabRect(ClientRect());
     //tabRect.iTl.iY+=40;
     tabRect.iBr.iY=tabRect.iTl.iY+55;
     
     //iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
     
     iTabGroup = CCustomTabControl::NewL(tabRect,NULL);
     //iTabGroup->SetContainerWindowL(*this);
     iTabGroup->MakeVisible(ETrue); 
     iTabGroup->SetFocus(ETrue); 
     
     //_LIT(KNebulaMbmFilename, "\\resource\\apps\\nebula.mbm");
     //CWsBitmap* neb = iEikonEnv->CreateBitmapL(KNebulaMbmFilename(),
    // EMbmNebulaNebula);
     
     //CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL( KTabBackgroundFileName, EMbmTabgroupGlobalnav_active );
     _LIT(KTabsFileName,"\\resource\\apps\\MyView.mbm");
     CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(KTabsFileName, EMbmMyviewList_icon_mask );
     iTabGroup->SetFocusedBackgroundImage(bitmap);
     
     //--CFbsBitmap* bitmap1 = iEikonEnv->CreateBitmapL( KTabBackgroundFileName, EMbmTabgroupGlobalnav_inactive );
     CFbsBitmap* bitmap1 = iEikonEnv->CreateBitmapL( KTabsFileName, EMbmMyviewList_icon );
     iTabGroup->SetDeFocusedBackgroundImage(bitmap1);
     
     
     CArrayPtr<CGulIcon>* tabiconArray = new (ELeave) CAknIconArray(4); 
     CleanupStack::PushL( tabiconArray ); 
     //iEikonEnv-&gt;CreateIconL(_L"z:\\system\\apps\\MyProg\\todoicon.mbm",1,1));
     tabiconArray->AppendL( iEikonEnv->CreateIconL( KTabsFileName,EMbmMyviewList_icon_mask) );
     tabiconArray->AppendL( iEikonEnv->CreateIconL( KTabsFileName,EMbmMyviewList_icon_mask) );
     tabiconArray->AppendL( iEikonEnv->CreateIconL( KTabsFileName,EMbmMyviewList_icon_mask)) ;
     tabiconArray->AppendL( iEikonEnv->CreateIconL( KTabsFileName,EMbmMyviewList_icon_mask));
     //tabiconArray->AppendL( iEikonEnv->CreateIconL( KTabsFileName,EMbmMyviewList_icon_mask)); 
     
     CleanupStack::Pop();
     
     // Transfers the ownership
     iTabGroup->SetIconArray(tabiconArray);
     
     
     CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(4);
     CleanupStack::PushL(array);
     array->AppendL(_L("first"));
     array->AppendL(_L("second"));
     array->AppendL(_L("third"));
     array->AppendL(_L("fourth"));
     //--array->AppendL(KItemTextTab3);
     //--array->AppendL(KItemTextTab4);
     //--array->AppendL(KItemTextTab5);
     CleanupStack::Pop();
     // Transfers the ownership 
     iTabGroup->SetTabTitleArray(array);
     iTabGroup->SetDefaultTabByIndex(2); 
     //AddToStackL(iTabGroup); 
     
     iTabGroup->DrawNow(); 
     }
    
    // End of File

Similar Threads

  1. LWUIT NUMBER OF TABS
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-08-22, 08:56
  2. S40 Textfield.Number limited 10 digits
    By rcaboni in forum Mobile Java General
    Replies: 4
    Last Post: 2008-03-20, 13:27
  3. Limited number of "if-statements"
    By patrickfrei in forum Symbian
    Replies: 12
    Last Post: 2006-12-27, 04:03
  4. 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
  5. Navigation Tabs (or Tabs Pane) in J2ME/Series 60
    By shadisky in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-05, 19:43

Posting Permissions

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