LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Registering mouse event on the desktop, not on the front panel

Hi everyone,

 

I have two open VIs, one filling the whole monitor and one filling only a part of it, floating above the other. The second one is created using VI Scripting and called by the first one. Therefore I don't think I can create an event structure with a mouse down event on that front panel, can I? That's why I was looking for a way to create that event on the first VI's front panel, but since the second front panel is floating above the first one, events are not registered. I also could not find a way to create a mouse event based on the coordinates of the mouse on the desktop. Did I overlook anything or is there another another way to achieve what I want?

 

Thanks.

0 Kudos
Message 1 of 3
(2,487 Views)

There are two issues:

 

  1. You cannot modify/configure event structures using scripting, although you can create them.
  2. You cannot get mouse events outside a VI running in the current runtime engine.

However, you can work around the issues in your case with a template.  Create a VI which has a configured event structure in it.  Open this in your scripting code, select the event structure and Move it to the target (Copy/Paste is far slower).  This may destroy the whole purpose of scripting the new code, but hopefully not.

 

If you are doing much scripting, you may consider using the LabVIEW scripting engine.

0 Kudos
Message 2 of 3
(2,461 Views)

@LordSnow wrote:
[...] I also could not find a way to create a mouse event based on the coordinates of the mouse on the desktop.[...]

User32.dll has a Mouse_Event property. Access it with a Call Library Function Node. That will get the event done, then just use Acquire Input Data.vi to get the area in which you want the mouse event to happen. There's probably examples in the forums.

 

Richard






0 Kudos
Message 3 of 3
(2,459 Views)