×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    How can i use CAknToolbar Control

    How can i Add CAknToolbar,CAKnButton control in my Container(View) ?

  2. #2
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: How can i use CAknToolbar Control


  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    Re: How can i use CAknToolbar Control

    I am getting this 2 errors
    (1) ToolBar.rsg: No such file or directory ToolBar.rss
    (2) undefined identifier 'R_TOOL_BAR_CONTAINER_TOOL_BAR_CONTAINER_VIEW' ToolBarContainerView.cpp

    and also i want to kbow that where i need to modify Mixin Class(MAknToolbarObserver) with the following 2 lines ?

    1. virtual void OfferToolbarEventL( TInt aCommand ) = 0;
    2. virtual void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );

  4. #4
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: How can i use CAknToolbar Control

    Check your .rss file for errors. Also you sure that you have defined resourse named R_TOOL_BAR_CONTAINER_TOOL_BAR_CONTAINER_VIEW in .rss?

    You need to derive class from Toolbar observer to get notification on the Toolbar events. For example:

    /// ***AppUi.h
    Code:
    #include <akntoolbarobserver.h> // Include this header file for MAknToolbarObserver and Link against: eikcoctl.lib
    .....
    .....
    class C***AppUi : public CAknAppUi, public MAknToolbarObserver
    {
    ....
    ....
    //From MAknToolbarObserver
    	void OfferToolbarEventL(TInt aCommand);
            void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
    ....
    ....	
    };
    /// ***AppUi.cpp
    Code:
    void C***AppUi::ConstructL()
    {
    	......
     
    	//Set "this" to toolbar observer - We will receive events in OfferToolbarEventL
    	if(CurrentFixedToolbar())
    	{
    		CurrentFixedToolbar()->SetToolbarObserver(this);
    	}
    	.......
    	.......
    }
     
    //From MAknToolbarObserver
    void C***AppUi::OfferToolbarEventL(TInt aCommand)
    {
    	HandleCommandL(aCommand); // In this example we are simply calling HandleCommandL by passing received command
    }
    
    void C***AppUi::DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar )
    {
    ...
    ...
    ...
    }

    Also check example application attached to article - http://wiki.forum.nokia.com/images/3/37/Toolbar.zip

  5. #5
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    Re: How can i use CAknToolbar Control

    still i am getting the following error when i am trying to add resource in .._reg.rss file
    (1)RCOMP failed - deleting output files
    (2)Lable not found
    please check my code

    RESOURCE APP_REGISTRATION_INFO
    {
    app_file="ToolBar1";
    localisable_resource_file = qtn_loc_resource_file_1;
    localisable_resource_id = R_LOCALISABLE_APP_INFO;
    custom_app_info_extension = r_toolbar_ext; // Error : Lable not found
    embeddability=KAppNotEmbeddable;
    newfile=KAppDoesNotSupportNewFile;
    }

  6. #6
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: How can i use CAknToolbar Control

    Quote Originally Posted by mit@indianic.com
    to add resource in .._reg.rss file
    You need to edit not <ProjectName>_reg.rss file but <ProjectName>.rss:
    Code:
    RESOURCE EIK_APP_INFO
    	{
    	menubar = r_menubar;
    	cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    	custom_app_info_extension = r_toolbar_ext;
    	}
    Look into example application and use it as a base.

  7. #7
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    Re: How can i use CAknToolbar Control

    Thanks for your reply.

    i am getting the following error

    (1) in <AppName>.rss file

    RESOURCE AVKON_TOOLBAR r_test_toolbar
    {
    id = ECommand1; //Error: Cannot convert "ECommand1" to a number
    }

    (2) in <AppName>Document.cpp

    CEikAppUi* CToolBar1Document::CreateAppUiL()
    {
    return new ( ELeave ) CToolBar1AppUi; // Error: illegal use of abstract class ('CToolBar1AppUi::OfferToolbarEventL(int)')
    }

  8. #8
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: How can i use CAknToolbar Control

    Quote Originally Posted by mit@indianic.com
    i am getting the following error

    (1) in <AppName>.rss file

    RESOURCE AVKON_TOOLBAR r_test_toolbar
    {
    id = ECommand1; //Error: Cannot convert "ECommand1" to a number
    }
    Add an enumerator for your command to the command id enumeration. Open the <ProjectName>.hrh file. It will to look something like this:

    Code:
    ...
    ...
    // Toolbar enumerate command codes
    enum TToolbarIds
    	{
    	ECommand1 = 0x6001, // start value must not be 0
    	ECommand2,
    	EHelp,
    	EAbout
    	};
    ...
    ...
    The second error arises from the first.

    Also I again suggest you to look into example project.

  9. #9
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    Re: How can i use CAknToolbar Control

    i have seen that example project but not running here...

    and in my project i am getting only 1 error:

    RCOMP failed - deleting output files

    ======== <App>.rss file Code =====================================
    ==================================================================

    /*
    ========================================================================
    Name : ToolBar1.rss
    Author : IndiaNIC
    Copyright : ...
    Description :
    ========================================================================
    */
    NAME TOOL

    #include <avkon.rsg>
    #include <avkon.rh>
    #include <eikon.rh>
    #include <appinfo.rh>
    #include "ToolBar1.hrh"
    #include "ToolBar1.loc"

    RESOURCE RSS_SIGNATURE
    {
    }
    RESOURCE TBUF
    {
    buf = "ToolBar1";
    }
    //commented by mitesh
    //RESOURCE EIK_APP_INFO r_application_tool_bar1_app_ui
    //{
    //cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    //status_pane = r_application_status_pane;

    //}
    RESOURCE STATUS_PANE_APP_MODEL r_application_status_pane
    {
    }
    RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
    {
    short_caption = STR_ToolBar1Application_5;
    caption_and_icon = CAPTION_AND_ICON_INFO
    {
    caption = STR_ToolBar1Application_4;
    number_of_icons = 0;
    };
    }
    RESOURCE TBUF r_application_akn_view_reference1
    {
    }

    RESOURCE EIK_APP_INFO
    {
    menubar = r_menubar;
    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    custom_app_info_extension = r_toolbar_ext; // This is the line we need to include to enable Toolbar
    }

    // Add following resource definition for toolbar declared in EIK_APP_INFO
    RESOURCE EIK_APP_INFO_EXT r_toolbar_ext
    {
    popup_toolbar = r_test_toolbar;
    }

    RESOURCE AVKON_TOOLBAR r_test_toolbar
    {
    flags = KAknToolbarFixed;
    items =
    {
    TBAR_CTRL
    {
    type = EAknCtButton;
    id = ECommand1; // In this example, we are using same set of commands as of used in AppUi:HandleCommandL
    control = AVKON_BUTTON
    {
    flags = KAknButtonTextInsideFrame;
    states =
    {
    AVKON_BUTTON_STATE
    {
    txt = "button1";
    helptxt = "help text1";
    }
    };
    };
    },
    TBAR_CTRL
    {
    type = EAknCtButton;
    id = ECommand2; // In this example, we are using same set of commands as of used in AppUi:HandleCommandL
    control = AVKON_BUTTON
    {
    flags = KAknButtonTextInsideFrame;
    states =
    {
    AVKON_BUTTON_STATE
    {
    txt = "button2";
    helptxt = "help text2";
    }
    };
    };
    }
    };
    }

    #include "ToolBar1Container.rssi"

  10. #10
    Regular Contributor
    Join Date
    Feb 2009
    Location
    Ahmedabad
    Posts
    51

    Re: How can i use CAknToolbar Control

    all error are solved but when i am trying to run application in Emulator it gives me Application Closed: message
    KERN-EXEC 3:

    What can i do for this ?

  11. #11
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Re: How can i use CAknToolbar Control

    Were u able to find the problem regarding the panic.

  12. #12
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: How can i use CAknToolbar Control

    As he didn't reply yet, probably not. However: most KERN-EXEC 3 errors (read: all of em except a few) are arising due to you using some kind of resource which is either null or in another form fuxated.

    The best way to fix the problem is to set multiple breakpoints and find out at WHICH line of code the tool dies. Once you know that, you can look at the involved variables...
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

Similar Threads

  1. Replies: 3
    Last Post: 2009-02-28, 13:57
  2. Replies: 0
    Last Post: 2009-02-20, 07:38
  3. Changing control sizes in CEikDialog derived class
    By zmiceruk in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-01-20, 18:03
  4. Replies: 0
    Last Post: 2008-02-16, 11:36
  5. AppUi - Control communication.
    By Subotai4Winds in forum Symbian
    Replies: 1
    Last Post: 2005-01-20, 08:53

Posting Permissions

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