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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
sletrab

VI Scripting: Get reference of Block Diagram object beneath mouse

Status: New

Hello,

 

LabVIEW known which object is beneath the mouse even if it is not selected!

I want to know it also. For example, you could create a constant to this Terminal of Property Node via shortcut.

 

9 Comments
David_L
Active Participant

This is actually done in Darren's quick drop plugin Create Object from Terminal.  It uses the input device VIs to get the mouse position and compares it to the objects on the diagram.  Perhaps not the easiest solution but it does the trick.

sletrab
Member

 

 

sletrab
Member

Hello David_L,

Thanks for your commend. I tried it and it works under normal circumstances. But it has problems with overlapping objects (case structure, event structure, stacked sequence).
The SubVI which substitute the requested feature takes 1 second on a large VI and 600 ms on a very simple VI. This is not "QUICK drop".
And both can be solved through the requested feature.

tst
Knight of NI Knight of NI
Knight of NI

Well, one of the classes (probably Top Level Diagram) does have a method for getting the object at a certain position, but I'm assuming it's a private method and that the position it uses is diagram position, so you would need to get that from the mouse cursor position.


___________________
Try to take over the world!
sletrab
Member

Hello David_L,

I can not see such a Method

 

 

Methods of Class TopLevelDiagram.jpg

 

tst
Knight of NI Knight of NI
Knight of NI

Looking at it now, I can see that as I suspected, it's a private method.

 

You could try to go to the LV APIs group. There's a thread there where you can ask for private features to be made public. The method is called Object From Point and it belongs to the Diagram class. I have no idea if it actually works since I haven't tried it.


___________________
Try to take over the world!
Darren
Proven Zealot

Object From Point does not work (you get Error 1071: Specified method not found).  Oh, how I wish it did work, though.  🙂

Darin.K
Trusted Enthusiast
>>Error 1071 Yes I have seen this before. There was another Method I desperately wanted (DeleteJoint), I was told that the error meant there was a prototype in the header, but no actual method. It was CAR'd and I'll let you wager whether the fix will be to add the Method or delete the prototype in the header. Here's to hoping this method sees the light of day.
sletrab
Member

Hm,

I think I have not explained the full possibilities.

When you want to speed up your coding you must speed up the actions which you do 1000 times a day.

You can directly react on keystrokes in a special VI which is running all the time . So press Space+r (not Ctrl, because there are already too many shortcuts) you create a reference for the selected Terminal. On Space+p a Property Node. On Space+t you hide or show the Label of all selected objects on the Blockdiagram, …

All of this can already work now.

It you hove over a SubVI Terminal, or some other terminal, like a tunnel, a single input of a property node or whatelse you could create a constant with Space+c if the new Function would be available. At the moment you must for example select the whole SubVI and then you must create a constant for all Inputs.

 

These are the basic actions. And no time consuming Ctrl+Space and writing the abbrevation for some functions.