×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    34

    How to hide/replace the default menu options in a form??

    Hi All

    How to hide/replace the default menu options (Add Field, Edit Label, Save, Delete Field) associated with a form. I want to define my own options instead of these default options.
    here is how i implemented in rss and cpp file but its not working i m getting the these options in (Edit, Add Field, Edit Label, Save, Delete Field, however none of this is working) form menu and my options does not appear at all.

    RESOURCE FORM r_form
    {
    flags=EEikFormEditModeOnly;
    items=
    {
    DLG_LINE
    {
    type=EEikCtEdwin;
    prompt="Email From:";
    id = EFilter;
    control= EDWIN
    {
    width = 15;
    maxlength = 256;
    };
    },

    DLG_LINE
    {
    type = EAknCtPopupFieldText;
    prompt = "Attachment";
    id = EAknPopUpListFieldAttach;
    itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
    control =POPUP_FIELD_TEXT
    {
    popupfield=POPUP_FIELD
    {
    width = 9;
    //other ="Other..";
    };
    textarray = r_attach_list_array;
    };
    }

    };
    }

    RESOURCE MENU_BAR r_menubar
    {
    titles =
    {
    MENU_TITLE
    {
    menu_pane = r_menu_pane;
    }
    };
    }

    RESOURCE MENU_PANE r_menu_pane
    {
    items =
    {
    MENU_ITEM
    {
    command = ESave;
    txt = "Save";
    },
    MENU_ITEM
    {
    command = EExit;
    txt = "Exit";
    }

    };
    }

    CAknPrefForm* CAknPrefForm::NewL()
    {
    CAknPrefForm* self =
    new (ELeave) CAknPrefForm();
    CleanupStack::PushL(self);
    self->ConstructL(R_MENUBAR);
    CleanupStack::Pop();
    return self;
    }

    void CAknPrefForm::ConstructL(TInt aMenuResource)
    {
    CAknForm::ConstructL(aMenuResource);
    }
    void CAknPrefForm::ProcessCommandL(TInt aCommandId)
    {

    switch(aCommandId)
    {

    case EPrefSave:// saving some data
    break;

    case EPrefExit: User::Exit(1);
    }
    }
    void CAknPrefForm:ynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
    {

    if (aResourceId == R_MENUBAR)
    {
    aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
    CAknForm:ynInitMenuPaneL(aResourceId,aMenuPane);

    }
    }
    On debugging i found that if clause of DynInitMenuPaneL() doesnt execute at all
    if(aResourceId==R_MENUBAR)
    {
    ....... //control doesnt reach here
    }

    I tried this also
    if(aResourceId==R_MENU_PANE)
    {
    ....... //control doesnt reach here
    }

    this too does nt work
    why its so? what can be the reason?
    whats missing here in my code?
    can anyone plz tell me
    waiting for a reply

  2. #2
    Regular Contributor
    Join Date
    Jan 2005
    Posts
    63

    Re: How to hide/replace the default menu options in a form??

    Quote Originally Posted by symnewbie
    Hi All

    How to hide/replace the default menu options (Add Field, Edit Label, Save, Delete Field) associated with a form. I want to define my own options instead of these default options.
    here is how i implemented in rss and cpp file but its not working i m getting the these options in (Edit, Add Field, Edit Label, Save, Delete Field, however none of this is working) form menu and my options does not appear at all.

    RESOURCE FORM r_form
    {
    flags=EEikFormEditModeOnly;
    items=
    {
    DLG_LINE
    {
    type=EEikCtEdwin;
    prompt="Email From:";
    id = EFilter;
    control= EDWIN
    {
    width = 15;
    maxlength = 256;
    };
    },

    DLG_LINE
    {
    type = EAknCtPopupFieldText;
    prompt = "Attachment";
    id = EAknPopUpListFieldAttach;
    itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
    control =POPUP_FIELD_TEXT
    {
    popupfield=POPUP_FIELD
    {
    width = 9;
    //other ="Other..";
    };
    textarray = r_attach_list_array;
    };
    }

    };
    }

    RESOURCE MENU_BAR r_menubar
    {
    titles =
    {
    MENU_TITLE
    {
    menu_pane = r_menu_pane;
    }
    };
    }

    RESOURCE MENU_PANE r_menu_pane
    {
    items =
    {
    MENU_ITEM
    {
    command = ESave;
    txt = "Save";
    },
    MENU_ITEM
    {
    command = EExit;
    txt = "Exit";
    }

    };
    }

    CAknPrefForm* CAknPrefForm::NewL()
    {
    CAknPrefForm* self =
    new (ELeave) CAknPrefForm();
    CleanupStack::PushL(self);
    self->ConstructL(R_MENUBAR);
    CleanupStack::Pop();
    return self;
    }

    void CAknPrefForm::ConstructL(TInt aMenuResource)
    {
    CAknForm::ConstructL(aMenuResource);
    }
    void CAknPrefForm::ProcessCommandL(TInt aCommandId)
    {

    switch(aCommandId)
    {

    case EPrefSave:// saving some data
    break;

    case EPrefExit: User::Exit(1);
    }
    }
    void CAknPrefForm:ynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
    {

    if (aResourceId == R_MENUBAR)
    {
    aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
    CAknForm:ynInitMenuPaneL(aResourceId,aMenuPane);

    }
    }
    On debugging i found that if clause of DynInitMenuPaneL() doesnt execute at all
    if(aResourceId==R_MENUBAR)
    {
    ....... //control doesnt reach here
    }

    I tried this also
    if(aResourceId==R_MENU_PANE)
    {
    ....... //control doesnt reach here
    }

    this too does nt work
    why its so? what can be the reason?
    whats missing here in my code?
    can anyone plz tell me
    waiting for a reply

    Hi,

    try out this piece of code and see whether its working or not in your code...

    void CAknPrefForm:ynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
    {

    if (aResourceId == R_MENU_PANE)
    {
    aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
    aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
    aMenuPane->SetItemDimmed(ESave, EFalse);
    aMenuPane->SetItemDimmed(EExit, EFalse);
    }
    }

Similar Threads

  1. Menu in Form fails to show up...
    By bjorn.rudolfsson in forum Symbian User Interface
    Replies: 14
    Last Post: 2007-04-05, 20:24
  2. Menu Options
    By mshita in forum Mobile Java General
    Replies: 2
    Last Post: 2005-05-30, 03:24
  3. 6600 item commands & options menu
    By random_john_doe in forum Mobile Java General
    Replies: 0
    Last Post: 2003-12-10, 16:18
  4. Changing default FORM options - Simulator Dies
    By krsunil in forum Symbian User Interface
    Replies: 4
    Last Post: 2003-10-08, 15:22
  5. How to control Nokia 7650 Form default menu constants
    By varshajohn in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-10-21, 09:57

Posting Permissions

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