ClassesClassesClassesClasses | | | | Operators

open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow (Operator)

Name

open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow — Open a graphics window.

Signature

open_window( : : Row, Column, Width, Height, FatherWindow, Mode, Machine : WindowHandle)

Herror open_window(const Hlong Row, const Hlong Column, const Hlong Width, const Hlong Height, const Hlong FatherWindow, const char* Mode, const char* Machine, Hlong* WindowHandle)

Herror T_open_window(const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, const Htuple FatherWindow, const Htuple Mode, const Htuple Machine, Htuple* WindowHandle)

Herror open_window(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine, Hlong* WindowHandle)

Hlong HWindow::OpenWindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine) const

void OpenWindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine, HTuple* WindowHandle)

void HWindow::HWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& FatherWindow, const HString& Mode, const HString& Machine)

void HWindow::HWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const HString& Mode, const HString& Machine)

void HWindow::HWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const char* Mode, const char* Machine)

void HWindow::OpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& FatherWindow, const HString& Mode, const HString& Machine)

void HWindow::OpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const HString& Mode, const HString& Machine)

void HWindow::OpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const char* Mode, const char* Machine)

void HOperatorSetX.OpenWindow(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT FatherWindow, [in] VARIANT Mode, [in] VARIANT Machine, [out] VARIANT* WindowHandle)

void HWindowX.OpenWindow(
[in] Hlong Row, [in] Hlong Column, [in] Hlong Width, [in] Hlong Height, [in] VARIANT FatherWindow, [in] BSTR Mode, [in] BSTR Machine)

static void HOperatorSet.OpenWindow(HTuple row, HTuple column, HTuple width, HTuple height, HTuple fatherWindow, HTuple mode, HTuple machine, out HTuple windowHandle)

public HWindow(int row, int column, int width, int height, HTuple fatherWindow, string mode, string machine)

public HWindow(int row, int column, int width, int height, IntPtr fatherWindow, string mode, string machine)

void HWindow.OpenWindow(int row, int column, int width, int height, HTuple fatherWindow, string mode, string machine)

void HWindow.OpenWindow(int row, int column, int width, int height, IntPtr fatherWindow, string mode, string machine)

Description

open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow opens a new window, which can be used to perform output of gray value data, regions, graphics as well as to perform textual output. All output (disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, disp_imagedisp_imageDispImagedisp_imageDispImageDispImage, etc.) is redirected to this window, if the same logical window number WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle is used.

The background of the created window is set to black in advance and it has a white border, which is 2 pixels wide (see also set_window_attr(::'border_width',<Width>:)set_window_attr("border_width",<Width>)SetWindowAttr("border_width",<Width>)set_window_attr("border_width",<Width>)SetWindowAttr("border_width",<Width>)SetWindowAttr("border_width",<Width>)).

Certain parameters used for the editing of output data are assigned to a window. These parameters are considered during the output itself (e.g., with disp_imagedisp_imageDispImagedisp_imageDispImageDispImage or disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion). They are not specified by an output operator, but by “configuration operators”. If you want to set, e.g., the color red for the output of regions, you have to call set_color(::WindowHandle,'red':)set_color(WindowHandle,"red")SetColor(WindowHandle,"red")set_color(WindowHandle,"red")SetColor(WindowHandle,"red")SetColor(WindowHandle,"red") before calling disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion. These parameters are always set for the window with the logical window number WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle and remain assigned to a window as long as they will be overwritten. You may use the following configuration operators:

You may query current set values by calling operators like get_shapeget_shapeGetShapeget_shapeGetShapeGetShape. As some parameters are specified through the hardware (Resolution/Colors), you may query current available ressources by calling query_colorquery_colorQueryColorquery_colorQueryColorQueryColor.

The origin of the coordinate system of the window resides in the upper left corner (coordinates: (0,0)). The row index grows downward (maximal: HeightHeightHeightHeightHeightheight-1), the column index grows to the right (maximal: WidthWidthWidthWidthWidthwidth-1). You have to keep in mind, that the range of the coordinate system is independent of the window size. It is specified only through the image format (see reset_obj_dbreset_obj_dbResetObjDbreset_obj_dbResetObjDbResetObjDb).

The parameter MachineMachineMachineMachineMachinemachine indicates the name of the computer, which has to open the window. In case of a X-window, TCP-IP only sets the name, DEC-Net sets in addition a colon behind the name. The “server” resp. the “screen” are not specified. If the empty string is passed the environment variable DISPLAY is used. It indicates the target computer. At this the name is indicated in common syntax <Host>:0.0.

For windows of type 'X-Window' and 'WIN32-Window' the parameter FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow can be used to determine the father window for the window to be opened. In case the control 'father' is set via set_checkset_checkSetCheckset_checkSetCheckSetCheck, FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow relates to the ID of a HALCON window, otherwise (set_check('~father')) it relates to the ID of an operating system window. If FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow is passed the value 0 or 'root', then under Windows and Unix-like systems the desktop and the root window become the father window, respectively. In this case, the value of the control 'father' (set via set_checkset_checkSetCheckset_checkSetCheckSetCheck) is irrelevant. The caller must ensure that FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow is a valid handle and not destroyed as long as the embedded HALCON window is used.

You may use the value “-1” for parameters WidthWidthWidthWidthWidthwidth and HeightHeightHeightHeightHeightheight. This means, that the according value has to be specified automatically. In particular this is of importance, if the proportion of pixels is not 1.0 (see set_systemset_systemSetSystemset_systemSetSystemSetSystem): Is one of the two parameters set to “-1”, it will be specified through the size which results out of the proportion of pixels. Are both parameters set to “-1”, they will be set to the maximum image format, which is currently used (further information about the currently used maximum image format can be found in the description of get_systemget_systemGetSystemget_systemGetSystemGetSystem using “width” or “height”).

Position and size of a window may change during runtime of a program. This may be achieved by calling set_window_extentsset_window_extentsSetWindowExtentsset_window_extentsSetWindowExtentsSetWindowExtents, but also through external interferences (window manager). In the latter case the poperator set_window_extentsset_window_extentsSetWindowExtentsset_window_extentsSetWindowExtentsSetWindowExtents is provided.

Opening a window causes the assignment of a called default font. It is used in connection with operators like write_stringwrite_stringWriteStringwrite_stringWriteStringWriteString and you may overwrite it by performing set_fontset_fontSetFontset_fontSetFontSetFont after calling open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow. On the other hand you have the possibility to specify a default font by calling set_system(::'default_font',<Fontname>:)set_system("default_font",<Fontname>)SetSystem("default_font",<Fontname>)set_system("default_font",<Fontname>)SetSystem("default_font",<Fontname>)SetSystem("default_font",<Fontname>) before opening a window (and all following windows; see also query_fontquery_fontQueryFontquery_fontQueryFontQueryFont).

You may set the color of graphics and font, which is used for output operators like disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion or disp_circledisp_circleDispCircledisp_circleDispCircleDispCircle, by calling set_rgbset_rgbSetRgbset_rgbSetRgbSetRgb, set_hsiset_hsiSetHsiset_hsiSetHsiSetHsi, set_grayset_graySetGrayset_graySetGraySetGray or set_pixelset_pixelSetPixelset_pixelSetPixelSetPixel. Calling set_insertset_insertSetInsertset_insertSetInsertSetInsert specifies how graphics is combined with the content of the image repeat memory. Thereto you may achieve by calling, e.g., set_insertset_insertSetInsertset_insertSetInsertSetInsert(::'not':) to eliminate the font after writing text twice at the same position.

Normally every output (e.g., disp_imagedisp_imageDispImagedisp_imageDispImageDispImage, disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, disp_circledisp_circleDispCircledisp_circleDispCircleDispCircle, etc.) in a window is terminated by a called “flush”. This causes the data to be fully visible on the display after termination of the output operator. But this is not necessary in all cases, in particular if there are permanently output tasks or if there is a mouse procedure active. Therefore it is more favorable (i.e., more rapid) to store the data until sufficient data is available. You may stop this behavior by calling set_system(::'flush_graphic','false':)set_system("flush_graphic","false")SetSystem("flush_graphic","false")set_system("flush_graphic","false")SetSystem("flush_graphic","false")SetSystem("flush_graphic","false").

The content of windows is saved (in case it is supported by special driver software); i.e., it is preserved, also if the window is hidden by other windows. But this is not necessary in all cases: If the content of a window is built up permanently new (copy_rectanglecopy_rectangleCopyRectanglecopy_rectangleCopyRectangleCopyRectangle), you may suppress the security mechanism for that and hence you can save the necessary memory. This is done by calling set_system(::'backing_store','false':)set_system("backing_store","false")SetSystem("backing_store","false")set_system("backing_store","false")SetSystem("backing_store","false")SetSystem("backing_store","false") before opening a window. In doing so you save not only memory but also time to compute. This is significant for the output of video clips (see copy_rectanglecopy_rectangleCopyRectanglecopy_rectangleCopyRectangleCopyRectangle).

For graphical output (disp_imagedisp_imageDispImagedisp_imageDispImageDispImage,disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, etc.) you may adjust the window by calling the operator set_partset_partSetPartset_partSetPartSetPart in order to represent a logical clipping of the image format. In particular this implicates that you obtain this clipping (with appropriate enlargement) of images and regions only.

Difference: graphical window - textual window

The parameter ModeModeModeModeModemode determines the mode of the window. It may have following values:

'visible':

Normal mode for graphical windows: The window is created according to the parameters and all input and output are possible.

'invisible':

Invisible windows are not displayed in the display. Parameters like RowRowRowRowRowrow, ColumnColumnColumnColumnColumncolumn and FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow do not have any meaning. Output to these windows has no effect. Input (read_stringread_stringReadStringread_stringReadStringReadString, mouse, etc.) is not possible. You may use these windows to query representation parameter for an output device without opening a (visible) window. Common queries are, e.g., query_colorquery_colorQueryColorquery_colorQueryColorQueryColor and get_string_extentsget_string_extentsGetStringExtentsget_string_extentsGetStringExtentsGetStringExtents.

'transparent':

These windows are transparent: the window itself is not visible (edge and background), but all the other operations are possible and all output is displayed. A common use for this mode is the creation of mouse sensitive regions.

'buffer':

These are also not visible windows. The output of images, regions and graphics is not visible on the display, but is stored in memory. Parameters like RowRowRowRowRowrow, ColumnColumnColumnColumnColumncolumn and FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow do not have any meaning. You may use buffer windows, if you prepare output (in the background) and copy it finally with copy_rectanglecopy_rectangleCopyRectanglecopy_rectangleCopyRectangleCopyRectangle in a visible window. Another usage might be the rapid processing of image regions during interactive manipulations. Textual input and mouse interaction are not possible in this mode.

Attention

You may keep in mind that parameters as RowRowRowRowRowrow, ColumnColumnColumnColumnColumncolumn, WidthWidthWidthWidthWidthwidth and HeightHeightHeightHeightHeightheight are constrained by the output device. If you specify a father window (FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow < > 'root') the coordinates are relative to this window.

Parallelization

Parameters

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 (lin)

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 (lin)

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: 256

Typical range of values: 0 ≤ Width Width Width Width Width width (lin)

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: 256

Typical range of values: 0 ≤ Height Height Height Height Height height (lin)

Minimum increment: 1

Recommended increment: 1

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

FatherWindowFatherWindowFatherWindowFatherWindowFatherWindowfatherWindow (input_control)  pointer HTupleHTupleHTupleVARIANTHtuple (integer / string) (IntPtr / IntPtr) (Hlong / HString) (Hlong / char*) (Hlong / BSTR) (Hlong / char*)

Logical number of the father window. To specify the display as father you may enter 'root' or 0.

Default value: 0

Restriction: FatherWindow >= 0

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Window mode.

Default value: 'visible' "visible" "visible" "visible" "visible" "visible"

List of values: 'buffer'"buffer""buffer""buffer""buffer""buffer", 'invisible'"invisible""invisible""invisible""invisible""invisible", 'transparent'"transparent""transparent""transparent""transparent""transparent", 'visible'"visible""visible""visible""visible""visible"

MachineMachineMachineMachineMachinemachine (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Name of the computer on which you want to open the window. Otherwise the empty string.

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

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

Window identifier.

Example (HDevelop)

open_window(0,0,400,-1,'root','visible','',WindowHandle)
read_image(Image,'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)

Example (C)

open_window(0,0,400,-1,"root","visible","",&WindowHandle) ;
read_image(&Image,"fabrik") ;
disp_image(Image,WindowHandle) ;
write_string(WindowHandle,"File: fabrik") ;
new_line(WindowHandle) ;
get_mbutton(WindowHandle,NULL,NULL,NULL) ;
set_lut(WindowHandle,"temperature") ;
set_color(WindowHandle,"blue") ;
write_string(WindowHandle,"temperature") ;
new_line(WindowHandle) ;
write_string(WindowHandle,"Draw Rectangle") ;
new_line(WindowHandle) ;
draw_rectangle1(WindowHandle,&Row1,&Column1,&Row2,&Column2) ;
set_part(Row1,Column1,Row2,Column2) ;
disp_image(Image,WindowHandle) ;
new_line(WindowHandle) ;

Example (HDevelop)

open_window(0,0,400,-1,'root','visible','',WindowHandle)
read_image(Image,'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)

Example (HDevelop)

open_window(0,0,400,-1,'root','visible','',WindowHandle)
read_image(Image,'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)

Example (HDevelop)

open_window(0,0,400,-1,'root','visible','',WindowHandle)
read_image(Image,'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)

Example (HDevelop)

open_window(0,0,400,-1,'root','visible','',WindowHandle)
read_image(Image,'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)

Result

If the values of the specified parameters are correct open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow returns 2 (H_MSG_TRUE). If necessary an exception is raised.

Possible Predecessors

reset_obj_dbreset_obj_dbResetObjDbreset_obj_dbResetObjDbResetObjDb

Possible Successors

set_colorset_colorSetColorset_colorSetColorSetColor, query_window_typequery_window_typeQueryWindowTypequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeGetWindowTypeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeSetWindowTypeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionSetTpositionset_tpositionSetTpositionSetTposition, set_tshapeset_tshapeSetTshapeset_tshapeSetTshapeSetTshape, set_window_extentsset_window_extentsSetWindowExtentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsGetWindowExtentsget_window_extentsGetWindowExtentsGetWindowExtents, query_colorquery_colorQueryColorquery_colorQueryColorQueryColor, set_checkset_checkSetCheckset_checkSetCheckSetCheck, set_systemset_systemSetSystemset_systemSetSystemSetSystem

Alternatives

open_textwindowopen_textwindowOpenTextwindowopen_textwindowOpenTextwindowOpenTextwindow

See also

disp_regiondisp_regionDispRegiondisp_regionDispRegionDispRegion, disp_imagedisp_imageDispImagedisp_imageDispImageDispImage, disp_colordisp_colorDispColordisp_colorDispColorDispColor, set_lutset_lutSetLutset_lutSetLutSetLut, query_colorquery_colorQueryColorquery_colorQueryColorQueryColor, set_colorset_colorSetColorset_colorSetColorSetColor, set_rgbset_rgbSetRgbset_rgbSetRgbSetRgb, set_hsiset_hsiSetHsiset_hsiSetHsiSetHsi, set_pixelset_pixelSetPixelset_pixelSetPixelSetPixel, set_grayset_graySetGrayset_graySetGraySetGray, set_partset_partSetPartset_partSetPartSetPart, set_part_styleset_part_styleSetPartStyleset_part_styleSetPartStyleSetPartStyle, query_window_typequery_window_typeQueryWindowTypequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeGetWindowTypeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeSetWindowTypeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionSetTpositionset_tpositionSetTpositionSetTposition, set_window_extentsset_window_extentsSetWindowExtentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsGetWindowExtentsget_window_extentsGetWindowExtentsGetWindowExtents, set_window_attrset_window_attrSetWindowAttrset_window_attrSetWindowAttrSetWindowAttr, set_checkset_checkSetCheckset_checkSetCheckSetCheck, set_systemset_systemSetSystemset_systemSetSystemSetSystem

Module

Foundation


ClassesClassesClassesClasses | | | | Operators