LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse position on picture

Solved!
Go to solution

I'm using a picture control with mouse down/mouse move event detection. With the "Mouse" property of picture control i can tell the relative position of mouse cursor on picture. My problem is that the picture control has scrollbars, and even clicks/moves on the scrollbars fire the events! Is there a practical way to tell if mouse is on scrollbars or on real picture?

0 Kudos
Message 1 of 10
(4,986 Views)

Hi,

 

Here's a quick example that :

- tests the width of the vertical scrollbar for the picture control

- continuously checks if the mouse is in the zone of the vertical scrollbar

- lets you show / hide the vertical scrollbar

 

Hope this helps

 

it's in LV2010, let me know if you need and older version.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 10
(4,971 Views)

Is it possible for you to post this VI and then I can take a look at it?

0 Kudos
Message 3 of 10
(4,969 Views)

Thank you, at the moment i have only LV 2009.

 

Sorry my app is not easy to post but to get the interesting part just place a picture control with visible toolbars, an event structure with a "mouse down" event, and you're there

 

 

0 Kudos
Message 4 of 10
(4,964 Views)

here you go with 2009.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 5 of 10
(4,959 Views)

Doesn't work when the image is scrolled horizontally; but i got the point, to "measure" the scrollbar you get picture size with scrollbar hidden and with scrollbar shown and then compute the difference

0 Kudos
Message 6 of 10
(4,954 Views)

Yes, I left it for you to do the horizontal check, just to make sure you understand it Smiley Wink and also because I'm lazy Smiley Very Happy


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 10
(4,949 Views)
Solution
Accepted by topic author Snamprogetti

Ok, i found a much simpler solution. You don't need to "measure" the toolbars; the DrawAreaSize property of pictures returns the drawable area excluding toolbars. The attached snippet checks if you're on the scrollbars

Message 8 of 10
(4,928 Views)

ERRATA CORRIGE: using ">" with a cluster and "compare aggregates" compares only the first element... here is a correct version.

Also, you may want to check that mouse is not on the frame or the caption, so i added a "> 0"

0 Kudos
Message 9 of 10
(4,896 Views)

best solution 

0 Kudos
Message 10 of 10
(3,062 Views)