LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse Clicks/Positons in Pictures!

Even a guru learns new things...

I just discovered the use of a picture control/indicator to detect mouse positions and clicks! What a wonderful thing. I have LabVIEW 6.0.2, and have, up to now, not known about this. To all those out there who I recommended to use the mouse click API for Windows, I apologize. This is such a marvelous way to get Mouse information. It's easy, efficient, and completely held within LabVIEW.

If anyone is wondering what I am talking about, go to Help>Examples in LabVIEW and go to the Examples>Advanced Examples>Picture Control Examples>Mouse Control.vi to see what I mean. I didn't realize that if you dropped a picture control (even as an invisible object!) on the front panel that you could use prop
erty nodes to get x and y positions, and also the left, right, shift left or right, and third mouse button click information.

Of course, I hear that this may all be somewhat obsolete in LabVIEW 6.1, but for those still using 6.01 or earlier, it's a great tool that means you don't have to mess with API, MFC or dlls.

Any comments or questions?
0 Kudos
Message 1 of 12
(4,141 Views)
Hi,

This is ideal for some applications, you can even build drag/drop functions
into a picture control using this. But there are some backdraws (or one very
big one);

The picture control needs to be the control on front.
The picture control needs to cover the entire area you need information on.

This implies that normal functions of controls and indicators cannot be
used, not even simply clicking on a button...

It also makes the screen updates take a lot more proccessor time, because
controls/indicators are overlapping. In the example for instance, the charts
are not clear to read, because they're flickering.

Regards,

Wiebe.


"Labviewguru" wrote in message
news:506500000008000000CD390000-1011517314000@exchange.ni.com...
> Even a guru learns new things..
.
>
> I just discovered the use of a picture control/indicator to detect
> mouse positions and clicks! What a wonderful thing. I have LabVIEW
> 6.0.2, and have, up to now, not known about this. To all those out
> there who I recommended to use the mouse click API for Windows, I
> apologize. This is such a marvelous way to get Mouse information.
> It's easy, efficient, and completely held within LabVIEW.
>
> If anyone is wondering what I am talking about, go to Help>Examples in
> LabVIEW and go to the Examples>Advanced Examples>Picture Control
> Examples>Mouse Control.vi to see what I mean. I didn't realize that
> if you dropped a picture control (even as an invisible object!) on the
> front panel that you could use property nodes to get x and y
> positions, and also the left, right, shift left or right, and third
> mouse button click information.
>
> Of course, I hear that this may all be somewhat obsolete in LabVIEW
> 6.1, but for those still using 6.01 or earlier, it's a great t
ool that
> means you don't have to mess with API, MFC or dlls.
>
> Any comments or questions?
0 Kudos
Message 2 of 12
(4,141 Views)
"This implies that normal functions of controls and indicators cannot be
used, not even simply clicking on a button..."

Yes you can (not easy). Compare the mouse click position with the boundries of the control...

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 12
(4,141 Views)
Yes, it can be done, but I hardly can call this 'normal functioning', and as
you mentioned this is not so easy...

Anyway, LV6.1 should be 'event driven' so prehaps there is way to get a
'Hover Over' message from whatever you want!

Regards,

Wiebe.

"Ben" wrote in message
news:5065000000050000002D5B0000-1011517314000@exchange.ni.com...
> "This implies that normal functions of controls and indicators cannot
> be
> used, not even simply clicking on a button..."
>
> Yes you can (not easy). Compare the mouse click position with the
> boundries of the control...
>
> Ben
0 Kudos
Message 5 of 12
(4,141 Views)
Well my friend, I did knew that specific trick, but I want to take this opportunity to express that I have learn a lot from this forum and the listserv. LV is a great software, but is the ingenuity and creativity of people mixed with knowledge and experience which make all the difference. There are very clever and intelligent people here!

Talking about re-discoveries: I remember a while ago somebody asking for a method to find the circle that fit a bunch of points. There were several answers, some of them suggesting center of mass, etc. Recently I discovered that LabVIEW include a function called "Fitting on a Sphere.vi", which determines the best spherical fit on a cloud of points in 3D. This mean the problem was already solved in LabVIEW! (Of course, unless some o
ther restrictions existed for that specific problem)

Functions -> Mathematics -> Optimization

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 4 of 12
(4,141 Views)
Oh yeah. I've used this to build a "battleships" game. Used a .bmp of waves for the background and the mouse position and mouse click properties to work out which square the user was clicking on. Fairly simple and it was my learning VI for TCP/IP communications. Two users on different computers playing each other. The program was almost too popular here. I had to keep all of the other buttons outside the play area though. If you put the buttons on top of the picture control, you do not get mouse position or click information and if you put them behind the picture control the button does not work directly (you can simulate it programmatically).

There's more than one way to skin a cat. Each method has its own merits.

Rob
0 Kudos
Message 6 of 12
(4,141 Views)
I would have to imagine that if you have the need for a complicated map of items where you need mouse information, that you can always build several picture frames and group them or something. I have always wanted to do something with HTML type interfacing in LabVIEW. If it weren't for the fact that I would be wasting my time building my own customer HTML control/Indicator using Pictures, I would do it. But I know the guys at NI will do it for us. Nevertheless, It is something I will still experiment with. Hopefully the NI guys are dilligently working on this problem. Who knows, maybe they will hire me to solve it...

I have found that there is a lot that can be done using this method. For example, mouseover effects is the greatest. I have always want
ed to be able to highlight a button with some form of image change using mouse information. My fear has always been in relying on the opsys for this information. I am still hopeful that one day, Windows won't be "it" and all my work on platform independent code will pay off.

I will play around a bit with effects and post the results here...

...Okay, played around a bit. Basically, I can setup a page to mimic a basic HTML Browser, even so far as to exactly mimic (with the exception of right clicks of the mouse) the behavior of a web page. This is great stuff. I will play around some more and post the results.

Good forum, and thanks to all for your input.
0 Kudos
Message 7 of 12
(4,141 Views)
In my application I could use 6.1 or 6.0 but I still can't do it.
I need to use the mouse to select,highlight and show the x and y of an object on my round screen,could you please help me to do this.
0 Kudos
Message 8 of 12
(4,141 Views)
Hi Adeeb,
I understand you want to click on your radar indicator and return the mouse position for marking, highligthing and so on.
If this is right, there are several way to do it; one is to place a transparent picture over the indicator and get the mouse clicks by its Mouse property.
See your vi modified.
The problem is that LV has only rectangular picture indicators, therefore you have to filter mouse positions on the four corner outside the circle.
To highlight a plane when you click on it, you simply have to change its picture appearance when the mouse click correspond to the plane picture area.
It takes some more extra programming, but it can be done.
Hope it was helpful,
Alberto
0 Kudos
Message 9 of 12
(4,141 Views)
thanks alberto for that and can tell me how would I have the center of the screen as (0,0) for x and y.
which is the center of the picture control.
0 Kudos
Message 10 of 12
(4,141 Views)