×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    67

    Smile defining custom menu items in CAknForm

    I like to ask if there is a way to override the default menu items in a CAknForm class? If so how can it be done? Welcome any suggestions.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    279

    Re: defining custom menu items in CAknForm

    Of course
    Code:
    void CMyFormDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
    {
    	CAknDialog::DynInitMenuPaneL(aResourceId, aMenuPane);
    	if ( aResourceId == R_AVKON_FORM_MENUPANE )
        {
            aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
    	}
    }

  3. #3
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    67

    Re: defining custom menu items in CAknForm

    Hi microsoft2,
    thanks for your reply.Your suggestion hides the existing menu items in a form but is there a way to add new menu items to the form?Appreciate your help.

  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    279

    Re: defining custom menu items in CAknForm

    Why not just check the CEikMenuPane class, you can do whatever you want.

    Note that usually you define all the menu items in the resource file and then dynamically hide some of them depending on the current selected item.
    If you have S60 SDK 2 Fp 3 open this url in your explorer
    mk:@MSITStore:C:\Symbian\8.1a\S60_2nd_FP3\Series60Doc\S60_CPP_SDK_2nd_fp3_DevGuides.chm::/Avkon_UI_Resources_Forms/3.5_Defining_Your_Own_Menu_Items_in_a_Form.htm
    or search on "Defining Your Own Menu Items in a Form"

  5. #5
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    67

    Re: defining custom menu items in CAknForm

    Hi microsoft2,
    thanks for your reply. I have only S60 SDK 2.0 and are unable to go to the link you suggested. It will be a great help if you can provide me some online links or if you can copy and paste the information in the SDK you suggested.
    Anyway thanks for you help.

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    279

    Re: defining custom menu items in CAknForm

    Hi Chan Fookmun,
    you can download this pdf http://ncsp.forum.nokia.com/download/?asset_id=12436
    and go to Creating forms/Defining you own ...
    All the writing is basically for CAknForm::ConstructL(TInt aMenuBarResId) where you specify the resourse id of the menu bar you want to use for the form. So just call that function and have fun (after PrepareLC may be?)

    Btw it is a great idea to have nokia`s docs on the net so we can send links from the SDK, can anyone upload those html-s ?

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

    Re: defining custom menu items in CAknForm

    Hi,

    if you want to have custom menu you should

    1/ Put MENU_BAR resource id into CAknForm::ConstructL() and override DynInitMenuPaneL

    void CFormItems:ynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
    {
    CAknForm:ynInitMenuPaneL( aResourceId, aMenuPane); // don't forget this!!!
    if ( aResourceId == R_AVKON_FORM_MENUPANE )
    {
    aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue );
    aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue );
    aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue );
    aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue );
    aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue );
    }
    }

    2/ Or call something like code below if you wish to not use resources:

    void CDBMSexampleForm::AddMenuItem(const TDesC &aDesC, TInt aCommandId, CEikMenuPane* aMenuPane)
    {
    CEikMenuPaneItem::SData itemData;
    itemData.iText = aDesC;
    itemData.iCommandId = aCommandId;
    itemData.iFlags = 0;
    itemData.iCascadeId = 0;
    aMenuPane->AddMenuItemL( itemData );
    }
    Taken from:
    http://discussion.forum.nokia.com/fo...=CAknForm+menu

    Regards,
    STeN

  8. #8
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    364

    Re: defining custom menu items in CAknForm

    See This Thread I think it may help you:
    http://discussion.forum.nokia.com/fo...d.php?t=101542

Similar Threads

  1. How to add items dynamically to the double pop menu style list box
    By vinayakak in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-12-07, 08:16
  2. Menu Items broken?
    By aeliasen in forum Personal Profile
    Replies: 2
    Last Post: 2005-04-28, 12:55
  3. How to get User defined menu items in a form?
    By sridhar_ratna in forum Symbian
    Replies: 1
    Last Post: 2003-03-25, 09:41
  4. How to get User defined menu items in a form?
    By sridhar_ratna in forum Symbian
    Replies: 1
    Last Post: 2003-03-16, 18:44
  5. How to get User defined menu items in a form?
    By sridhar_ratna in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-03-14, 02:23

Posting Permissions

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