LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting attribute on menu bar items

How do you grey out an item on a menu  bar ?
How Do change the default values on pannel after you went through it once ?
0 Kudos
Message 1 of 5
(3,578 Views)
HI jsugrim,

You can set the Dimmed attribute for the menu bar.  For example, suppose you had a menu bar with the constant name MENU, an item called Item1 and a child item of Item1 called Child. Then to dim Child, you could say

hmenubar = GetPanelMenuBar (panelHandle);      // Getting handle to menubar
SetMenuBarAttribute (hmenubar, MENU_Item1_Child, ATTR_DIMMED, 1);    // Setting the dimmed attribute.

As to your second question, I am not sure what exactly you are asking. If you wanted to programmatically set a control's default value, you would need to set the Default Value attribute like this:

SetCtrlAttribute (panelHandle, PANEL_MyControl, ATTR_DFLT_VALUE, 2);  

If I didn't answer your second question, let me know.

Best Regards,
Jonathan N.
National Instruments
Message 2 of 5
(3,571 Views)

I'm not sure if there is a single function call to restore all controls to their default values as set in the UIR file.  (I presume this is the meaning of the second part of your question.)

The way I would do it is in your main program or Init function, read all the values from the controls(GetCtrlVal() ), store theses values, and then when you want to return to the defaults, reset them yourself (SetCtrlVal() ).

0 Kudos
Message 3 of 5
(3,564 Views)

Hi jsugrim,

to manipulate menu items there is a useful instruction that is InstallMenuDimmerCallback which has been discussed in CVI Tips / Trick thread: you can look at that thread for some comment on it.

Regarding the default values, it's not clear if you want to change the default value for some control or to return controls to their default value: in the first case you can follow Jonathan suggestion, while in the second case you can use DefaultPanel or DefaultCtrl functions.

I also want to point you to two useful functions wich are SavePanelState and RecallPaneState: they permits you to save on disk actual values of all controls in a panel and restore them afterwards.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,553 Views)

Thank you

All of the solutions works very well.

Thanks again,

Jsugrim

0 Kudos
Message 5 of 5
(3,543 Views)