ClassesClassesClassesClasses | | | | Operators

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

dev_open_windowdev_open_windowDevOpenWindowdev_open_windowDevOpenWindowDevOpenWindow (Operator)


dev_open_windowdev_open_windowDevOpenWindowdev_open_windowDevOpenWindowDevOpenWindow — Open a new graphics window.


dev_open_window( : : Row, Column, Width, Height, Background : WindowHandle)

Herror dev_open_window(const Hlong Row, const Hlong Column, const Hlong Width, const Hlong Height, const Hlong Background, Hlong* WindowHandle)

Herror T_dev_open_window(const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, const Htuple Background, Htuple* WindowHandle)

Herror dev_open_window(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& Background, Hlong* WindowHandle)

Hlong HWindow::DevOpenWindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& Background) const

void DevOpenWindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& Background, HTuple* WindowHandle)

void HWindow::DevOpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& Background)

void HWindow::DevOpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, Hlong Background)

void HOperatorSetX.DevOpenWindow(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT Background, [out] VARIANT* WindowHandle)

void HWindowX.DevOpenWindow(
[in] Hlong Row, [in] Hlong Column, [in] Hlong Width, [in] Hlong Height, [in] VARIANT Background)

static void HOperatorSet.DevOpenWindow(HTuple row, HTuple column, HTuple width, HTuple height, HTuple background, out HTuple windowHandle)

void HWindow.DevOpenWindow(int row, int column, int width, int height, HTuple background)

void HWindow.DevOpenWindow(int row, int column, int width, int height, int background)


dev_open_windowdev_open_windowDevOpenWindowdev_open_windowDevOpenWindowDevOpenWindow opens a new graphics window, which can be used to display iconic objects like images, regions, and lines as well as to perform textual output. This window automatically becomes active, which means that all output (dev_displaydev_displayDevDisplaydev_displayDevDisplayDevDisplay and automatical display of operator results) is redirected to this window. This is shown by the lucent lamp on the Active button.

The standard HALCON display, drawing, mouse, text output, and visualization parameter operators (like disp_imagedisp_imageDispImagedisp_imageDispImageDispImage, disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, draw_circledraw_circleDrawCircledraw_circleDrawCircleDrawCircle, get_mbuttonget_mbuttonGetMbuttonget_mbuttonGetMbuttonGetMbutton, write_stringwrite_stringWriteStringwrite_stringWriteStringWriteString, set_rgbset_rgbSetRgbset_rgbSetRgbSetRgb, etc.) need the logical window number that is returned in the parameter WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle and displayed in the title bar of the graphics window.

The background of the created window is set to the color specified in BackgroundBackgroundBackgroundBackgroundBackgroundbackground. This parameter is not available for the operator open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow. There, the same behavior can be achieved by calling set_window_attr(::'background_color',Background:)set_window_attr("background_color",Background)SetWindowAttr("background_color",Background)set_window_attr("background_color",Background)SetWindowAttr("background_color",Background)SetWindowAttr("background_color",Background) in advance.

The graphics window is closed by pressing the Close button of the window frame, via the Visualization menu, or by calling dev_close_windowdev_close_windowDevCloseWindowdev_close_windowDevCloseWindowDevCloseWindow.

The origin of the graphics window is the upper left corner with the coordinates (0,0). The x values (columns) increase from left to right, the y values (rows) increase from top to bottom. As a default, the coordinate system is set in a way that images are displayed without clipping and fitting completely into the graphics window. The coordinate system is adapted to the windows size according to this rule for the first image that is displayed after a program reset or the loading of a new program or if the current image has a different image size than the image that was displayed before. The size of the window is not adapted automatically, hence, if the aspect ratio of the image differs from that of the window, the image is distorted to fit into the window. This can be changed via the Window Size menu.

The visible image part can be changed interactively by spinning the mouse wheel, using the Move or Zoom mode, via the Image Size menu, with the help of the Zoom tab card on the Visualization Parameters dialog, or with the operator dev_set_partdev_set_partDevSetPartdev_set_partDevSetPartDevSetPart.

Each graphics window manages a history which contains the

which have been displayed or changed since the most recent clear action or display of a full image. This history is used if a redraw of the window is triggered, e.g., after a change of the windows sise, in order to reconstruct the complete window contents. Other iconic output that was displayed using HALCON operators like disp_imagedisp_imageDispImagedisp_imageDispImageDispImage or disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, text (write_stringwrite_stringWriteStringwrite_stringWriteStringWriteString), or geometric objects (disp_linedisp_lineDispLinedisp_lineDispLineDispLine, disp_circledisp_circleDispCircledisp_circleDispCircleDispCircle, etc.) are not part of the history, and can therefore not be redrawn. Only the object classes image, region, and XLD that are displayed with the HDevelop operator dev_displaydev_displayDevDisplaydev_displayDevDisplayDevDisplay or by HDevelop actions like double clicking on an icon are part of the history.

Pressing the Clear button clears the graphics window contents and the history of the window. This can also be achived by using the operator dev_clear_windowdev_clear_windowDevClearWindowdev_clear_windowDevClearWindowDevClearWindow. This will not effect the current display parameters.

The size of the graphics window can be changed interactively by dragging the window border with the mouse. Furthermore, it is possible to adapt the window size to the image size (or a part or multiple of it) via the Window Size menu. Afterwards, the window content is redisplayed automatically using the same visible part as before.

The display parameters of the graphics window can be specified via its context menu, the Visualization menu, the Visualization Parameters dialog, or the appropriate HDevelop operators like dev_set_colordev_set_colorDevSetColordev_set_colorDevSetColorDevSetColor, dev_set_line_widthdev_set_line_widthDevSetLineWidthdev_set_line_widthDevSetLineWidthDevSetLineWidth, dev_set_drawdev_set_drawDevSetDrawdev_set_drawDevSetDrawDevSetDraw. Depending on the Apply Immediately preference, the parameter changes are applied to the lastly displayed object or apply from now on for all following objects. In contrast to the standard HALCON window operators, the new settings are also used for all new graphics windows.

Additional information about the underlying HALCON window can be found at open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow and about the HDevelop graphics window in the “HDevelop Reference Manual” chapter Graphical User Interface -> Graphics Window as well as in the “HDevelop User's Guide”.


Using the code export feature of HDevelop, the code that is generated for this operator may have a different behavior than the related HALCON operator. For a detailed description of the code export of HDevelop graphics operators into the different programming languages see in the “HDevelop User's Guide” the chapter Code Export -> General Aspects of Code Generation -> Graphics Windows.


RowRowRowRowRowrow (input_control)  rectangle.origin.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Row index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Row Row Row Row Row row

Minimum increment: 1

Recommended increment: 1

Restriction: Row >= 0

ColumnColumnColumnColumnColumncolumn (input_control)  rectangle.origin.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Column index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Column Column Column Column Column column

Minimum increment: 1

Recommended increment: 1

Restriction: Column >= 0

WidthWidthWidthWidthWidthwidth (input_control)  rectangle.extent.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Width of the window.

Default value: 512

Typical range of values: 0 ≤ Width Width Width Width Width width

Minimum increment: 1

Recommended increment: 1

Restriction: Width > 0 || Width == -1

HeightHeightHeightHeightHeightheight (input_control)  rectangle.extent.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Height of the window.

Default value: 512

Typical range of values: 0 ≤ Height Height Height Height Height height

Minimum increment: 1

Recommended increment: 1

Restriction: Height > 0 || Height == -1

BackgroundBackgroundBackgroundBackgroundBackgroundbackground (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*) (Hlong / BSTR) (Hlong / char*)

Color of the background of the new window.

Default value: 'black' "black" "black" "black" "black" "black"

WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (output_control)  window HWindow, HTupleHTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Window identifier.

Example (HDevelop)

dev_close_window ()
read_image (For5, 'for5')
get_image_size (For5, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (For5)
dev_set_lut ('rainbow')
dev_display (For5)
stop ()
dev_set_lut ('default')
dev_display (For5)
stop ()
dev_set_part (100, 100, 300, 300)
dev_display (For5)


If the values of the specified parameters are correct dev_open_windowdev_open_windowDevOpenWindowdev_open_windowDevOpenWindowDevOpenWindow returns 2 (H_MSG_TRUE). Otherwise an exception is raised and an error code returned.

Possible Successors

dev_displaydev_displayDevDisplaydev_displayDevDisplayDevDisplay, dev_set_lutdev_set_lutDevSetLutdev_set_lutDevSetLutDevSetLut, dev_set_colordev_set_colorDevSetColordev_set_colorDevSetColorDevSetColor, dev_set_drawdev_set_drawDevSetDrawdev_set_drawDevSetDrawDevSetDraw, dev_set_partdev_set_partDevSetPartdev_set_partDevSetPartDevSetPart



See also




ClassesClassesClassesClasses | | | | Operators