LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hardcode menu selection

How to hard code value for a menu selection?

I want a specific menu option to be selected if i click a particular button.

0 Kudos
Message 1 of 8
(3,570 Views)

Hi 30904407,

you can use the "Set Menu Item Info" function to mark an entry.

 

Mike

0 Kudos
Message 2 of 8
(3,560 Views)

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.

0 Kudos
Message 3 of 8
(3,554 Views)

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.

0 Kudos
Message 4 of 8
(3,549 Views)

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.)

Message 5 of 8
(3,526 Views)

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.

0 Kudos
Message 6 of 8
(3,501 Views)

Hi 30904407,

see the attached example.

 

Mike

0 Kudos
Message 7 of 8
(3,480 Views)

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.

0 Kudos
Message 8 of 8
(3,469 Views)