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 APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Disable control Right-click menu

Hi I want create one tool who disable right-click menu of all controls and indicators of one (or few)vi automatically when i edit it . But actually, i don't find any property or invoke on controls, who do that. Any suggestions... Best regards Eric

0 Kudos
Message 1 of 21
(12,432 Views)

The Frontpanel Window property "Allow Runtime PopUp" en/disables default context menus on the FP of a VI, be it at edit or at run time. This you can also achieve at edit time via the VI Properties, Subwindow "Window Appearance" --> "Allow default run-time shortcut menus".

As far as I understand what you want to do it would involve keeping the tool running all the time and checking, whether there is a new VI that has come into memory. Then the tool would change this property to false in the newly opened VI. Keep in mind though that this change will be saved as soon as you save the VI later. So if you don't want to save this change, the tool would also have to check for VIs that recently left memory and reverse the property change back again.

As this procedure seems a bit odd (at least to me, it does), I might have misunderstood what you are trying to achieve. Could you explain a bit more about the eventual goal you'd like to achieve?

0 Kudos
Message 2 of 21
(7,242 Views)

Thanks. But perhapse my request is not enough clear.It's not the pop-up or the Vi menu, that i try to manipulate. It's the right click menu of the controls. When you place one control to one front panel you can personalize its local right-click  menu( Enable/disable/edit). But in edit mode, you need to do that manually for all the controls, if you want lock their  local right-click menu and don't see them when your vi run. I want create one tool  who lock them in one time.

0 Kudos
Message 3 of 21
(7,242 Views)

Perhaps this is relevant - http://forums.ni.com/t5/LabVIEW/Reference-for-Run-Time-Shortcut-Menu/td-p/429864

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 4 of 21
(7,242 Views)

Thanks. But it's not exactly that i want to do. I have see this thick here https://decibel.ni.com/content/docs/DOC-17778. But with this , you need to draft this for all the controls. And it's  what i want to avoid.

0 Kudos
Message 5 of 21
(7,242 Views)

See if discarding Shortcut Menu Activation? at the Pane level rather than the Control level works for you.

If that does not work, a somewhat hacky way to do it for everything is to use the Mouse Down? and Mouse Up? events on the VI to discard all right clicks (I think it is button 2) while letting everything else pass. Tweak as needed. Remember that button 2 is not necessarily a robust way of doing this. Intercept the event on the VI.

0 Kudos
Message 6 of 21
(7,242 Views)

Drop this on any VI that you want this behavior. You'll have to connect something to it to stop the While Loop when the rest of your VI stops.

[Edited image after posting to remove flat sequence so I don't confuse future readers of this thread.]

Untitled.png

(I would make this a snippet but I didn't realize until I was done that I wrote this with LV 2015 which wouldn't help you much right now. Sorry.)

Message was edited by: AristosQueue

Message 7 of 21
(7,242 Views)

Is there any particular reason why deactivating all right-click menues using the FPWindow property is out of the running here? As far as I can see, you're looking for a way not having to mess around with events and individual references and so forth. Using the suggested property turns all those menues off for simply everything on the FrontPanel without any event structure and just using one reference. You could even wrap this into a QD shortcut as said property can be set during edit AND run-time.

Apart from that, I think DFGray's proposal is the simplest here. Never really thought about the "pane" references myself before...

NoRightClickMenusVIAPane.png

PS: As mentioned above I never dealt much with panes, so may be the above is not a foolproof way, as there are possibly more than pane to a VI.

0 Kudos
Message 8 of 21
(7,242 Views)

AristosQueue wrote:

(I would make this a snippet but I didn't realize until I was done that I wrote this with LV 2015 which wouldn't help you much right now. Sorry.)

The code capture tool allows backsaving snippets and it installs from VIPM. Just saying.


___________________
Try to take over the world!
Message 9 of 21
(7,242 Views)

tst wrote:

The code capture tool allows backsaving snippets and it installs from VIPM. Just saying.

You presume that Save For Previous works in my current branch of LV 2015. 🙂 Depending upon what debug mode and options I have enabled, that often goes awry. I try never to export code written in a development fork. I usually switch over to a released LV before posting something like this, but I forgot this time.

0 Kudos
Message 10 of 21
(7,242 Views)