Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Ignoring left-click while in zoom mode using IMAQ on VB.Net

Solved!
Go to solution

This has to be a common problem for IMAQ programmers?  The IMAQ camera image has a built-in right-click context menu, through which user can do stuff like change the display palette and select a mode by which to zoom in at a clicked point.  Once one selects the zoom mode, one then left-clicks the camera image as many times as desired, then exits zoom mode by going back to right-click context menu.

 

Okay, but here's the problem.  My left mouse-click event handler (using VB.Net) is also intercepting left mouse-clicks while the camera image is in zoom mode.  (One would think IMAQ would disallow propagating this event while in zoom mode!)  Because the software I am working with creates centroids upon left-click, it is a problem that left-clicking under zoom mode not only zooms but creates centroids.

 

Has anybody encountered this issue and does anybody have a usable workaround? (Certainly it cannot be just me!)

 

I figure it must be possible to ascertain what is the current mouse pointer icon while in zoom mode, or else the current state of the IMAQ camera image, and thereby disallow our software accepting left-clicks during zoom mode ... not exactly sure how to get at the methods and/or attributes invovled.  Fairly certain the available NI documentation will not be much help there and I will have to search the IMAQ objects using .Net Object Browser and/or using trial-and-error within program code.

 

It had occured to me to simply ignore the first left mouse-click after entering the right-click context menu.  However it is clear that one cal left-click the context menu multiple times and, as already described, multiple left-clicks on camera image are possible while in zoom mode.

 

Or ... is it possible there is a specialized mouse-click event handler which will behave as I would prefer it to ... and ignore events while accessing IMAQ right-click context menu functionality?

 

Thanks for any and all feedback!

0 Kudos
Message 1 of 4
(3,989 Views)
Solution
Accepted by tsfarrell
I believe CWIMAQViewer.Tool is the property you are looking for.  It returns a long data type and the value for the zoom tool should be '4'.
Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,959 Views)

Thanks for your post.  It is funny, I found exactly what you are referring to today.  Well, after messing with cursor handles and such stuff.  This was really easy.  Just bypass mouse events when the tool is not set to Rectangle or Oval.  Thanks again very much!

0 Kudos
Message 3 of 4
(3,956 Views)
Thanks Alex for sharing this.
Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
Assistant Lecturer
Mechatronics Department
Faculty of Engineering
Misr University for Science & Technology



View Waleed El-Badry's profile on LinkedIn

0 Kudos
Message 4 of 4
(3,955 Views)