04-02-2012 06:09 AM
Bonjour,
Je veux mettre comme visible un sous item d'un item. J'utlise SetMenuBarAttribute. La question, qu'est ce que je dois mettre comme 1er et deuxième paramètre: le menubar ou le item parent ?
Cordialement.
Solved! Go to Solution.
04-02-2012 06:23 AM
Bonjour,
this question can be answered by looking at the help, e.g. here
menuBarHandle is the first parameter, the menu item the second
04-02-2012 07:04 AM
it's not an item but un child of un item, then, i wonder about if i have to put the bar menu or the the sub item as first parameter.
04-02-2012 07:15 AM
Excuse moi,
my french isn't good enough to have realized the difference...
For submenues, the first parameter is the same menubar handle that you obtain from LoadMenuBar, the second parameter is the menu item id as assigned in the User Interface Editor, e.g. MENUBAR_ITEM1_2_ITEM1_4_ITEM1_14. It works both for menu items and submenu (child) items.
04-02-2012 07:23 AM
well, it doesn't work, see:
SetMenuBarAttribute (MENUBAR_EM_MENU_SUPERUSER,MENUBAR_EM_MENU_SUPERUSER_ITEM_SUPRESS_ITEM_SUP_CARTE,ATTR_DIMMED, 0);
the error:
NON-FATAL RUN-TIME ERROR: "authentification.c", line 47, col 13, thread id 0x00001168: Library function error (return value == -4 [0xfffffffc]). Panel, menu bar, or control array handle is invalid
04-02-2012 07:31 AM
How does your call of LoadMenuBar look like?
It should have some similarity with
panel_handle = LoadPanel ( 0, "my_gui.uir", PANEL );
menubar_handle = LoadMenuBar ( panel_handle, "my_gui.uir", MENUBAR ); Could it be that you confused the menubar_handle with MENUBAR?
04-02-2012 07:50 AM
I used the variables that i found in the .h file of the GUI see:
SetMenuBarAttribute (MENUBAR_EM_MENU_FILE, MENUBAR_EM_MENU_FILE_ITEM_IMPRESSION, ATTR_DIMMED, 0); //this one works because it's an item,
i didn't use the menubarhandel, just the the menubar name in the .h file
SetMenuBarAttribute ( MENUBAR_EM_MENU_SUPERUSER_ITEM_SUPRESS_SUBMENU,MENUBAR_EM_MENU_SUPERUSER_ITEM_SUPRESS_ITEM_SUP_CARTE,ATTR_DIMMED, 0);//this not because it's subitem
04-02-2012 08:02 AM
@FibiIA wrote:
i didn't use the menubarhandel, just the the menubar name in the .h file
Why are you averse to use the menubar_handle? I would assume that by chance your MENUBAR_EM_MENU_FILE has the same numeric value as the menubar_handle, and that's the reason why this line works...
04-02-2012 08:16 AM
ok, it works, i just put MENUBAR_EM_MENU_FILE as a handle, seams that it took it as a handle of the menu bar because it's the first one.
Thank you, i appreciated
04-02-2012 08:22 AM
Très bien!