| Customize Help

Displaying an image in a user-defined window

Images selected to a windowed display using MdispSelect() are presented in a default window created by MIL. This function dynamically creates a window on the Windows desktop for the specified display, if the display is not already selected. The created window respects any window control type setting associated with the display using an Mdisp...() function.

Alternatively, for windowed displays, you can choose to display image buffers in a user-defined window, using MdispSelectWindow(). Note that the window does not require the same dimensions as the image buffer. If the defined window is of a different dimension than the image buffer, any excess window area will be left untouched or any excess image area will be cropped.

Using MdispSelectWindow()

The MdispSelectWindow() function is similar to MdispSelect(), except that it allows you to specify the handle of the user-defined window or child window to use for display, rather than displaying into a MIL created window. This user-defined window is automatically refreshed when the display is modified (for example, when the image data is modified). You can use MdispSelectWindow() with M_NULL to remove the image from the display.

The user-defined window must have a window handle of type HWND or X11. You can use, for example, the Windows API functions to create a window with an HWND handle, and third-party functions (such as GTK or Qt) to create an X11 window handle. In addition, if the handle parameter of MdispSelectWindow() is set to zero, this function behaves like MdispSelect().

Note that, to use a display with a window created using the third-party GTK or Qt frameworks, you should enable a special mode. You can enable the mode by using MdispControl() with M_GTK_MODE or M_QT_MODE, respectively. These modes prevent the display from appearing incorrectly when the window is moved or resized, while introducing a small amount of latency.

To select an image to a user-defined window, the display cannot be allocated on a remote computer (MdispAlloc() with M_REMOTE_DISPLAY).

Note that, by default, mouse and keyboard use are disabled in a user-defined window. You can enable mouse and keyboard use in a user-defined window using MdispControl() with M_MOUSE_USE and M_KEYBOARD_USE, respectively.

The following example shows how to display an image in a user-defined window, grab into such a window, and remove the image from the display.