03-07-2011 03:55 AM
How to hard code value for a menu selection?
I want a specific menu option to be selected if i click a particular button.
03-07-2011 04:41 AM
Hi 30904407,
you can use the "Set Menu Item Info" function to mark an entry.
Mike
03-07-2011 04:53 AM
Set menu iten info just replaces the existing menu item with some new name.
Consider there is a menu option Edit->cut.
If i click a button, i want cut to be selected. I can select cut by case structure. But i am not getting how to select edit by clicking button.
I am attaching the block diagram. IN that i want edit to be selected by the menu selection event handler.
03-07-2011 05:03 AM - edited 03-07-2011 05:05 AM
Hi 30904407,
attached you'll find an example which shows how you can change the mark with a button.
Hope it helps.
Mike
Edit: If you need to run the same action if you press the button or the menu entry, then the example will not help. In this case you can use a queue to command the same action in a parallel running loop.
03-07-2011 09:29 AM
309...,
In your .jpg you show an event structure embedded inside another event structure. Don't do it! You are going to wind up having lots of problems with your code.
Event structures capture events even when they aren't in the current path of execution. So if you do a number of menu selection (Apps) before you do a Cut (Value Change) you'll wind up accumulating events in your queue for the inner event structure. Possibly to the point of even crashing your program, but at least to the point that your program will seem like it's not behaving the way you want to.
There should be only one event structure in any given while loop. Any given event case should run quickly enough so that the front panel always seems responsive to the user. Never trap an event structure in a piece of code that may not be executed or not executed for a long time (such as in a case structure or another event structure.)
03-07-2011 08:56 PM
Yes. I need to run the same action if i press the button or the menu entry. Could you please explain me how to use queue to handle this.
03-08-2011 02:01 AM
Hi 30904407,
see the attached example.
Mike
03-08-2011 03:35 AM
In this, it is a duplication of actions. I dont want to duplicate the actions.
If the value of button is changed, the cut option in the menu bar should be selected.
I cant duplicate it because i am using that cut option from the main menu bar of the LabView. I have created the run time menu by taking cut as application item. So its difficult to duplicate also.