Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

ImageViewer and context menu

I am currently developing a UI application that uses the NI-IMAQdx runtime libraries to interface to a GigEVision compliant camera.

I am using the NationalInstruments.Vision.WindowsForm.ImageViewer object to display the streaming video.

The issue I have encountered is with context menu is that right-clicking on the viewing region wont display the context menu. However, right-clicking on the ImageViewers tool bar (located at the bottom) will cause the context menu to display.

 

Is this a bug? I know there are a few out there with respect to the ImageViewer not resizing properly, so I am wondering if this is also an issue for anyone else.

 

Thank you,

 

-Tom

0 Kudos
Message 1 of 16
(5,927 Views)

Hey Tom,

 

Are you using VB .NET or Visual Studio? 

I tried running a shipping example in .NET and was not able to replicate the issue.

Andy Chang
National Instruments
0 Kudos
Message 2 of 16
(5,910 Views)

Andy,

 

Sorry I should have specified.

I am using C# in VS 2008.

 

0 Kudos
Message 3 of 16
(5,908 Views)

Which example are you using to test this?

Of the examples I have tried, not seem to have a context menu attached to the ImageViewer.


Thank you.

0 Kudos
Message 4 of 16
(5,893 Views)
Do you think you can post your VS code here? Which version of Vision Acquisition Software are you using? NI-Vision?
Andy Chang
National Instruments
0 Kudos
Message 5 of 16
(5,880 Views)

Current Software Versions according to the MAX:

 

NI-IMAQ 4.4

NI-IMAQ I/O 2.3.1

NI-IMAQdx 3.6

NI-PAL 2.5.3

NI-RIO 3.4

 

In terms of added references, this is the versions I am currently using:

 

NationalInstruments.Common Version 8.7.35.131

NationalInstruments.Vision.Acquisition.Imaqdx Version 3.40.35.49153

NationalInstruments.Vision.Common Version 9.0.35.45000

 

As far as code goes, there really isn't any to speak of. In the VS environment I create a context menu, named it, then added it to the ContextMenu property of the ImageViewer. The context menu appears when I right-click on the toolbar at the bottom of the ImageViewer, but not when I right-click on the actual image.

 

Thank you.

 

 

0 Kudos
Message 6 of 16
(5,839 Views)

Hi Tom,

 

I was able to reproduce this behavior in VS 2008 with the IMAQ Grab example (with a context menu added).  It only shows up when you click the borders that aren't covered up by the image portion.  The question now, is whether this is expected behavior, or if this is a bug.  I'll research into this some more, and post back with what I find. 

 

 

Cheers, 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 7 of 16
(5,810 Views)

Thank you for the help, I am glad you were able to reproduce the error.

 

In my opinion, this is not the intended behavior, at least not from a UI perspective. Also, when using the NI Measurement & Automation  Software (MAX), it uses what appears to be a similiar ImageViewer and the context menu appears regardless of where on the ImageViewer the user right-clicks. This is an indication that this is a bug (one of a few...) in the ImageViewer object.

 

Thank you again and I look forward to hearing what you discover.

0 Kudos
Message 8 of 16
(5,798 Views)

Hello Tom,

 

We have escalated this issue to the R&D group and we should hear back from them shortly. In the mean time, if you were to use CWIMAQViewer, you would be able to see the menu.

Andy Chang
National Instruments
0 Kudos
Message 9 of 16
(5,766 Views)

Thanks Andy.

 

It looks like CWIMAQViewer is a control in a different assembly and I do not want to add an assembly reference to my application only for the viewer. Besides that the CWIMAQViewer does not deal with VisionImage objects and all my code is written around VisionImage.

 

This is a non-critical bug that we will have to deal with until it is fixed (assuming it does in fact get fixed).

 

 Let me know the results from R&D.

0 Kudos
Message 10 of 16
(5,763 Views)