LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle shortcut key options in LabVIEW

Hi,

 

I want to handle the ctrl+c option for a string control in labview. I just want to prevent the user from pressing the ctrl+c button for copying. is it possible to handle that inEvent Structure?

 

Thanks

Alagar

0 Kudos
Message 1 of 9
(4,664 Views)

Hi Alagar,

can you describe what you try to do? You don´t get the key down event for "ctrl+c" but the key up. Maybe this is enough for you. Another solution could be to write a wrapper dll which hooks the key down event for you.

 

Hope it helps.

Mike

Message 2 of 9
(4,649 Views)

Alagar wrote:

Hi,

 

I want to handle the ctrl+c option for a string control in labview. I just want to prevent the user from pressing the ctrl+c button for copying. is it possible to handle that inEvent Structure?

 

Thanks

Alagar


 

The simplest solution would edit the controls run-time pop-up menu and remove the ctrl-c as an option.

 

Does that help?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 9
(4,640 Views)

Ben,

 

removing the entry Copy from the context menu is not sufficient. In order to disable the control to copy the current active selection, you have to disable <ctrl + c> as shortcut for copying data in the complete LabVIEW environment. You have to open the Tools >> Options, switch to Menu Shortcuts and browse to Edit >> Copy. Switch the shortcut to something else than <ctrl + c>. This will disable the copy function for the shortcut <ctrl + c> (it will occur with the new shortcut of course!)

 

Drawback:

a) You remove the ability to use <ctrl + c> from the whole LabVIEW environment. So also in edit mode of VIs.... 

b) When making a selection and then pressing <ctrl + c>, it will replace the selection with a simple 'c'. Most often, this is not intended.

 

So all in all, i would definetly NOT recommend anyone to alter the shortcuts for common functions defined by the OS (<ctrl + c> for Copy, <ctrl + n> for New Document, .... )

 

hope this helps,

Norbert 

Message Edited by Norbert B on 12-01-2008 08:41 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 9
(4,630 Views)

Good point Norbert.

 

Then in that case how about an event for "This VI" >>> Menu Selection ?

 

The Item Tag will indicate the type of operation.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 9
(4,623 Views)
If you don't want the user to be able to copy the data from the control, set the control to be disabled.  The user will not be able to select the text in the control.
Message Edited by Matthew Kelton on 12-01-2008 09:10 AM
Message 6 of 9
(4,620 Views)

Ben wrote:

[...]

Then in that case how about an event for "This VI" >>> Menu Selection ?

[...]


That will do.

 

Norbert 

 

PS: The item Tag would be "APP_COPY"

Message Edited by Norbert B on 12-01-2008 09:13 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 9
(4,617 Views)
Using an Event Structure, you can intercept the Ctrl-C and throw it away, if this is what you want to do (use Key Down? event - the question mark means you can modify or throw it away).  You will need to pass everything else.  Make sure you look at both capital and small "c"s.  I use similar logic to prevent Ctrl-. from killing an executable and to handle things like Alt-F4 when I want a controlled shutdown.
0 Kudos
Message 8 of 9
(4,569 Views)

Due to DFGrays reply, i made some tests on this question. It seems that there is a different behaviour if the CTRL + C is captured by <This VI> vs. a certain control. In fact, capturing CTRL + <Any key> is not possible for controls.

Attached you can find a workaround based on DFGrays suggestion.

 

The issue is reported as CAR #135342.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 9 of 9
(4,559 Views)