From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Right Click Menu

Solved!
Go to solution

Hi Folks,

 

I'm trying to get a custom right-click menu to change the text color on a Boolean control without success. I've researched this online and in the Help files and my code seems correct, but no-go. I would greatly appreciate someone taking a look at the attached vi and tell me where I've gone wrong.

 

Any help greatly appreciated.

0 Kudos
Message 1 of 22
(8,193 Views)

Although I had to create the menu myself, it worked for me.  Select a menu option then click stop and the button text changes color and the VI stops.  What do you expect to see?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 22
(8,189 Views)

Thanks for taking time to look over my code, sorry you had to build the menu, I thought it would go along with the vi.

 

I expected what you got, a color change on the Boolean text. It's good to know that at least the code works.

 

The fact that you had to create a menu may be a clue, I followed the Help file instructions and setup the menu first, before the case/while loop. Maybe that's wrong. I'll try it again.

 

But I do have another question. You mentioned that you selected the menu option and then hit STOP to get the color change. I was hoping that the color change would happen "on-the-fly" while the vi was still executing. But mine doesn't work either way. As you've probably already guessed this is part of a larger vi so I suppose I can always run this loop async and kill it off after the color change. Assuming I can ever get it to work.

 

Let me try re-building the menu and see if that helps.

0 Kudos
Message 3 of 22
(8,177 Views)

You can use an event structure to edit a run time menu as it running.  You can capture the Shortcut Menu >> Shortcut Menu Activation? This event is generated before generating a menu.  There you can use the menu reference to add and edit menu items programatically.

0 Kudos
Message 4 of 22
(8,173 Views)

Thanks for your thoughts Hooovahh. I saw several threads and help files that covered this topic during my research, but I'm not sure how changing the menu programatically with an Event Structure would help me get the color to change while the While Loop was still running. Am I missing something?

 

Or maybe this is a timing thing and you replied before my response. In which case you may be suggesting that I try to create the menu that way to see if it works. I'm a little reluctant to do that because the added complexity is probably not worht the cost for this "feature". Besides, NI says this should work and apparently it does for other folks. I just need to unravel the problem with my installation.

0 Kudos
Message 5 of 22
(8,167 Views)

Data flow!  Your large loop won't run until the small loop is stopped.  I moved that stuff into the larger loop and made Bob into my father's brother.

 

ButtonColorChange_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 6 of 22
(8,156 Views)

@jcarmody wrote:

I moved that stuff into the larger loop and made Bob into my father's brother.


Yes Bob would be your uncle

 

If you want an example of editing run time menus launch the example finder by going to Help >> Find Examples and search Run Time then find the Customizing Shortcut Menus.vi example.

 

Also you seem like a beginner so you may be interested in these links to free training.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

0 Kudos
Message 7 of 22
(8,152 Views)

Thanks Jim and Hooovahh, I am a beginner to be sure and I appreciate the help.

I have tried re-writing my menu, deleting all entries and rebuilding, again without success.

There's apparently something amiss with my installation and I'll have to get on to the guys at NI to resolve it.

 

Thanks again....

0 Kudos
Message 8 of 22
(8,135 Views)

A common thing to try is to do a repair install of LabVIEW if you believe things got broken some how.

 

Feel free to post any more code of your attempts to editing your run time menu.

0 Kudos
Message 9 of 22
(8,129 Views)

Have you tried the modifications I suggested?  What debugging steps have you tried?  I'd put a probe on the string feeding the selector terminal to see what you're getting from the Get Menu Selection.  Highlight Execution could also shed some light on where your data is going.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 10 of 22
(8,114 Views)