04-19-2011 08:00 AM
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?
Solved! Go to Solution.
04-19-2011 09:39 AM
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
04-19-2011 09:41 AM
Is it possible for you to post this VI and then I can take a look at it?
04-19-2011 09:50 AM
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
04-19-2011 09:54 AM
here you go with 2009.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
04-19-2011 10:06 AM
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
04-19-2011 10:13 AM
Yes, I left it for you to do the horizontal check, just to make sure you understand it and also because I'm lazy
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
04-27-2011 04:39 AM
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
04-28-2011 04:14 AM
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"
09-19-2018 08:44 AM
best solution