LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

fct SetMenuBarAttribute => refresh menubar display ?

Hi,

I want to check a “menubar” attribute. To do this I wrote this line:

SetMenuBarAttribute (MenuBar, MENUBAR_PRINTER_LPT2, ATTR_CHECKED,0);

When I use the GetMenuBarAttribute function to control if the attribute changed I see the good modification.

What I have to do to refresh the menu bar ? the modification doesn’t appeared on screen !!!

Witch function refresh a menu bar into a Main Panel after a SetMenuBarAttribue Function ?

Thanks

Marc
0 Kudos
Message 1 of 6
(4,012 Views)
of course...

SetMenuBarAttribute (MenuBar, MENUBAR_PRINTER_LPT2, ATTR_CHECKED,1); to put the check

SetMenuBarAttribute (MenuBar, MENUBAR_PRINTER_LPT2, ATTR_CHECKED,0); to hide the check
0 Kudos
Message 2 of 6
(4,007 Views)
SetMenuBarAttribute (MenuBar, MENUBAR_PRINTER_LPT2, ATTR_CHECKED,1); to put the check

but the check doesn't appear after executing this line.

What I have do more ?
0 Kudos
Message 3 of 6
(3,971 Views)
Hello Marc,

The menu item you are trying to "check" cannot be one of the items on the top level (as in, it has to be a child of another menu item). Top level menu items can be dimmed. On the other hand, child items can be set to dimmed, checked, and/or bold.

From your code, it looks like you have a top level menu item called "Printer" and a child item called "LPT2".
Using your setup, I was able to toggle the checkmark beside the "LPT2" menu item with the SetMenuBarAttribute
function. I testing this behavior in CVI 6, 7, and 7.1.

Which version of CVI are you using? I suspect this issue may be application specific. If you could attach a simple example that demonstrates the problem, I could take a look at it.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 6
(3,960 Views)
Here your are a example. I have the latest CVI version (7.1). I can change the state of the check (appear or disappear). I put the value into a debug variable. But the check doesn’t appear on the menu bar.

Thanks

Have a nice day

Mark
0 Kudos
Message 5 of 6
(3,952 Views)
Hello Marc,

Thanks for attaching your code.

The problem lies in your call to LoadMenuBar. In your code, you pass a value of 0 for the destination panel handle. Instead, you should pass the handle to your main panel (MainPanel). Also, if you choose to call the LoadMenuBar function, then you should not specify a menu bar on your panel in your UIR file (this would be like loading your menu bar twice on the same panel).

If you do want to specify a menu bar on your panel in your UIR file, then you can instead use the GetPanelMenuBar function to get a handle to the menu bar on your panel.

So in summary, to display the check mark on your panel, either:

1. Replace LoadMenuBar(...) with GetPanelMenuBar (MainHandle).

- or -

2. Remove the menu bar from your panel in your UIR file. Then, replace the first parameter of the LoadMenuBar function with your panel handle. i.e. LoadMenuBar (MainHandle, "menubar_item.uir", MENUBAR)


Hope that helps, and let me know if you need any clarification. Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
Message 6 of 6
(3,941 Views)