LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse Down On Image but Not On Scrollbar Event?

Solved!
Go to solution

Hi All,

 

I am using a "Mouse Down" event on an image to record the X and Y coordinates of the click and to increment a counter.  My problem is that I am looking at an image with a scroll bar that I want to use to adjust which part of the image is visible.  When I click on the scroll bar, I trigger the Mouse Down event and increment the counter, which I do not want to do.


Is there a way to set up a Mouse Down event so that it will ignore clicks on image scroll bars?  If not, can you think of another way to accomplish what I am trying to do?


Thanks!

Forbes Black
Lapsed CLAD, LV 2020 & 2018
0 Kudos
Message 1 of 4
(2,188 Views)
Solution
Accepted by diarmaede
A couple quick ideas:

The scroll bars will be a fixed height or width from the right side or bottom of the indicator. In the mouse down event handler, if the click occurs at a set of coordinates that you know are in a scrollbar region, don't increment the count.

OR

Perhaps you could overlay a transparent control over the image such that it covers the image but not the scrollbars, then look for clicks on that second control.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(2,173 Views)

That worked perfectly.  Thanks!  I used the Coords indicator in the event handler to define the area where mouse clicks "count."

Forbes Black
Lapsed CLAD, LV 2020 & 2018
0 Kudos
Message 3 of 4
(2,137 Views)

You can do this dynamically with these property nodes:

image01.png

 

"DrawAreaSize" will give you the draw are size of the picture excluding scrollbars, the "Mouse"-cluster contains information of the mouse position within the picture control (starting at 0,0). Hence X & Y position have to be smaller than "width" and "height" of the draw area in order to count as a valid click.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 4 of 4
(2,127 Views)