LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event from .NET Picture Box

I want to get a mouse up event when clicking on a .NET Picture Box. I am using the picture box to stream video through the VLC player. This is working perfectly. My only problem is that I'm not able to fire mouse events from clicking within the picture box. If I just create an empty picture box, events are working, but when video streaming is running, the events are just not working. I'm using LabView 2012 SP1. Any tips anyone ?

0 Kudos
Message 1 of 18
(4,365 Views)

Did you ever get this working.  I have the same need and problem.

Any help would be greatly appreciated!

 

 

0 Kudos
Message 2 of 18
(4,210 Views)

Would it work to make a different control, set all its colors to transparent, and then put it on top of the control, and then get events from that?

0 Kudos
Message 3 of 18
(4,189 Views)

I attempted that.

 

The .NET object will NOT allow anything to be 'in front' of it.

 

I have tried 'Move Forward', 'Move To Front' on the LabVIEW control; I have tried 'Move Backward' and 'Move To Back' for the .NET container -- the .NET container ALWAYS remains in front.

 

I'm certainly open to additional thoughts.

 

Thanks!

 

 

0 Kudos
Message 4 of 18
(4,171 Views)

Can you check to see if the "mouse down" event fires for the Pane object instead of the PictureBox object?  I am guessing not, but you never know.

 

I assume you've just been trying to get the event to show up using an Event structure.  Have you tried using the "Register event callback" node with the PictureBox reference and creating a callback VI that fires a user event?

0 Kudos
Message 5 of 18
(4,162 Views)

@RussSec wrote:

The .NET object will NOT allow anything to be 'in front' of it.

 

I have tried 'Move Forward', 'Move To Front' on the LabVIEW control; I have tried 'Move Backward' and 'Move To Back' for the .NET container -- the .NET container ALWAYS remains in front.


The .NET container displays the control in a child window, so it's always drawn on top and it doesn't get any of the panel events.

 

As suggested, using the .NET events with a callback VI is the way to go (look up examples). I'm not familiar with the PictureBox control, but a quick look shows it has a MouseDown event which does return X and Y values in its event data (I'm guessing global screen coords, but could also be local coords). The easy way to use it is to generate the callback VI, pass an event reference to it and have it translate the coords to pane coords and then fire that event so that you get the data in your VI as a standard event.


___________________
Try to take over the world!
0 Kudos
Message 6 of 18
(4,142 Views)

I began attempting .NET event last week before I started making posts.  To date, I have had no success.

The example I have found don't show how to associate the event to the control.  Any thoughts would be greatly appreciated!

0 Kudos
Message 7 of 18
(4,085 Views)

You didn't give any details, so I don't know how to answer your question, but this is what it looks like:

 

Mouse Down.PNG

 

 

Wiring the control into the node lets you select the relevant event, and you can then generate the callback VI with a right click, which has the correct class as the e element.

 

If that doesn't help, look up more examples and tutorials about .NET callbacks. If that doesn't help, post actual code.


___________________
Try to take over the world!
Message 8 of 18
(4,076 Views)

This is great info!  I had tried multiple things and didn't know what to post that might help!  The configuration of the callback vi is the piece I believe I'm missing.  I never got what you showed out of any examples!  I will give that a try!

Thanks!!

0 Kudos
Message 9 of 18
(4,072 Views)

Actually, LabVIEW is helpful enough to create the callback VI for you if you right-click the node:

 

Create callback.png

 

You pretty much don't want to do it any other way, because in addition to the format of the callback VI's terminals, it also needs to be set to be re-entrant, among other things.  Creating it automatically does all of that.

0 Kudos
Message 10 of 18
(4,052 Views)