×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Dec 2005
    Location
    Albacete, Spain
    Posts
    380

    Dimming a menu item

    Hello,

    The following code, part of a ListBox object (derived from CAknView and MListBoxUpdater), gives me a EIKCOCTL Panic 8 (No such menu item):

    Code:
    if(iItemList->Count() == 0)
    	{
    	this->MenuBar()->MenuPane()->SetItemDimmed(ELocalizadorListBoxViewBorrarMenuItemCommand, ETrue);
    //	iEikonEnv->AppUiFactory()->MenuBar()->MenuPane()->SetItemDimmed(ELocalizadorListBoxViewBorrarMenuItemCommand, ETrue);
    	}
    The relevant part of the resource file, generated auto by Carbide's UiDesigner, for this ListBox view is:

    Code:
    RESOURCE CBA r_localizador_list_box_control_pane
    	{
    	buttons =
    		{
    		CBA_BUTTON
    			{
    			id = EAknSoftkeyOptions;
    			txt = STR_LocalizadorListBoxView_1;
    			},
    		CBA_BUTTON
    			{
    			id = EAknSoftkeyExit;
    			txt = STR_LocalizadorListBoxView_2;
    			},
    		CBA_BUTTON
    			{
    			id = EAknSoftkeyEmpty;
    			txt = STR_LocalizadorListBoxView_3;
    			}
    		};
    	}
    RESOURCE MENU_PANE r_localizador_list_box_menu_pane1_menu_pane
    	{
    	items =
    		{
    		MENU_ITEM
    			{
    			cascade = r_localizador_list_box_menu_pane2;
    			txt = STR_LocalizadorListBoxView_24;
    			},
    		MENU_ITEM
    			{
    			command = ELocalizadorListBoxViewExportar_GPSMenuItemCommand;
    			txt = STR_LocalizadorListBoxView_5;
    			}
    		};
    	}
    RESOURCE MENU_PANE r_localizador_list_box_menu_pane2
    	{
    	items =
    		{
    		MENU_ITEM
    			{
    			command = ELocalizadorListBoxViewA_adirMenuItemCommand;
    			txt = STR_LocalizadorListBoxView_25;
    			},
    		MENU_ITEM
    			{
    			command = ELocalizadorListBoxViewBorrarMenuItemCommand;
    			txt = STR_LocalizadorListBoxView_26;
    			}
    		};
    	}
    Can anyone point me out what is the correct way to dimm the ELocalizadorListBoxViewBorrarMenuItemCommand menu item?

    /Juan
    ----------------------------------------------
    Every journey starts with a small step.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Dimming a menu item

    In the DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) function of your view do something like this :-

    Code:
    if(aResourceId == R_LOCALIZADOR_LIST_BOX_MENU_PANE2)
     {
     aMenuPane->SetItemDimmed(ELocalizadorListBoxViewBorrarMenuItemCommand , ETrue);
     }
    Cheers,
    Mayank

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,683

    Re: Dimming a menu item

    S60 builds a brand new instance of the menu whenever it gets displayed. Thus it is questionable what "this->MenuBar()->MenuPane()->SetItemDimmed(...)" could do, you should rather implement DynInitMenuPaneL
    Code:
    if(aResourceId == R_LOCALIZADOR_LIST_BOX_MENU_PANE2)
        aMenuPane->SetItemDimmed(ELocalizadorListBoxViewBorrarMenuItemCommand , iItemList->Count()==0);

  4. #4
    Registered User
    Join Date
    Dec 2005
    Location
    Albacete, Spain
    Posts
    380

    Re: Dimming a menu item

    Thanks Mayank,

    I guess that this works only during initialization of the menupane. I need to do it dynamically, at any time the number of items in the list iItemList reaches zero.

    User can add and remove items from the list at any time, and I need to adjust dim state of menus based on user input.

    So, how can I change dim state of a menu item of a view dynamically?

    BR/ Juan
    ----------------------------------------------
    Every journey starts with a small step.

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Dimming a menu item

    Quote Originally Posted by juannoguera View Post
    Thanks Mayank,

    User can add and remove items from the list at any time, and I need to adjust dim state of menus based on user input.
    But the moment you say he can add/remove items from the list, it would be done through the menu option only right? And the moment the user presses add/remove anyways the menu is going to close. So now if the menu is closed and now if the user wants to see the menu again the function mentioned ealier would be called where you can do the checking.

    So, how can I change dim state of a menu item of a view dynamically?
    BR/ Juan
    When you say dynamically I am not sure I quite understand, if you mean the menu is up and the number of items can become 0 or something you can try StopDisplayingMenuBar to close the menu pane and then simulate the option key press to bring up the menu pane in which case the function DynInit would be called again. This would have a slight flicker though.

    If I mis-understood your requirements please help me understand better :-)

    Cheers,
    Mayank

  6. #6
    Registered User
    Join Date
    Dec 2005
    Location
    Albacete, Spain
    Posts
    380

    Re: Dimming a menu item

    Thanks Mayank,

    Works OK with the code you provided.

    Number of items can become zero either because the user manually erases an item or because the process associated with the item times out. In both cases, your code works OK, since the menu is generated (i.e. initialized) every time the user presses the "option" softkey.

    BR/ Juan
    ----------------------------------------------
    Every journey starts with a small step.

Similar Threads

  1. How to dimmed Markable List Menu Item??
    By sunil304047 in forum Symbian
    Replies: 1
    Last Post: 2009-02-11, 05:21
  2. Different Selected Item in Menu Item
    By naresh99 in forum Symbian User Interface
    Replies: 3
    Last Post: 2006-11-06, 13:01
  3. slide menu in j2me
    By afka in forum Mobile Java General
    Replies: 4
    Last Post: 2006-09-04, 09:10
  4. how to get the position of a cascaded item in a menu?
    By GeKI in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-05-18, 15:47
  5. Dimming the Menu Item at runtime
    By amitaggarwal in forum Symbian
    Replies: 2
    Last Post: 2004-09-16, 08:31

Posting Permissions

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