HALCON Reference Manual 10.0.2
Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators

open_textwindowopen_textwindowopen_textwindowOpenTextwindowOpenTextwindow (Operator)

Name

open_textwindowopen_textwindowopen_textwindowOpenTextwindowOpenTextwindow — Open a textual window.

Signature

open_textwindow( : : Row, Column, Width, Height, BorderWidth, BorderColor, BackgroundColor, FatherWindow, Mode, Machine : WindowHandle)

Herror open_textwindow(const Hlong Row, const Hlong Column, const Hlong Width, const Hlong Height, const Hlong BorderWidth, const char* BorderColor, const char* BackgroundColor, const Hlong FatherWindow, const char* Mode, const char* Machine, Hlong* WindowHandle)

Herror T_open_textwindow(const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, const Htuple BorderWidth, const Htuple BorderColor, const Htuple BackgroundColor, const Htuple FatherWindow, const Htuple Mode, const Htuple Machine, Htuple* WindowHandle)

Herror open_textwindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& BorderWidth, const HTuple& BorderColor, const HTuple& BackgroundColor, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine, Hlong* WindowHandle)

Hlong HWindow::OpenTextwindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& BorderWidth, const HTuple& BorderColor, const HTuple& BackgroundColor, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine) const

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

void HWindowX.OpenTextwindow(
[in] Hlong Row, [in] Hlong Column, [in] Hlong Width, [in] Hlong Height, [in] Hlong BorderWidth, [in] BSTR BorderColor, [in] BSTR BackgroundColor, [in] VARIANT FatherWindow, [in] BSTR Mode, [in] BSTR Machine)

static void HOperatorSet.OpenTextwindow(HTuple row, HTuple column, HTuple width, HTuple height, HTuple borderWidth, HTuple borderColor, HTuple backgroundColor, HTuple fatherWindow, HTuple mode, HTuple machine, out HTuple windowHandle)

void HWindow.OpenTextwindow(int row, int column, int width, int height, int borderWidth, string borderColor, string backgroundColor, HTuple fatherWindow, string mode, string machine)

void HWindow.OpenTextwindow(int row, int column, int width, int height, int borderWidth, string borderColor, string backgroundColor, IntPtr fatherWindow, string mode, string machine)

Description

open_textwindowopen_textwindowopen_textwindowOpenTextwindowOpenTextwindow opens a new textual window, which can be used to perform textual input and output, as well as to perform output of images. All output (write_stringwrite_stringwrite_stringWriteStringWriteString, read_stringread_stringread_stringReadStringReadString, disp_regiondisp_regiondisp_regionDispRegionDispRegion, etc.) is redirected to this window, if the same logical window number WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle is used.

Besides the mouse cursor textual windows possess also a textual cursor which indicates the current writing position (more exactly: the lower left corner of the output string without consideration of descenders). Its position is indicated through an underscore or another type (the indication of this position may also be disabled (= default setting); cf. set_tshapeset_tshapeset_tshapeSetTshapeSetTshape). You may set or query the position by calling the operators set_tpositionset_tpositionset_tpositionSetTpositionSetTposition or get_tpositionget_tpositionget_tpositionGetTpositionGetTposition.

After you opened a textual window the position of the cursor is set to (H,0). Whereby H significates the height of the default font less the descenders. But the cursor is not shown. Hence the output starts for writing in the upper left corner of the window.

You may query the colors of the background and the image edges by calling query_colorquery_colorquery_colorQueryColorQueryColor. In the same way you may use query_colorquery_colorquery_colorQueryColorQueryColor in a window of type 'invisible'. During output (write_stringwrite_stringwrite_stringWriteStringWriteString) you may set the clipping of text out of the window edges by calling set_check(::'~text':). This disables the creation of error messages, if text passes over the edge of the window.

The origin of the coordinate system of the window resides in the upper left corner (coordinates: (0,0)). The row index grows downward (maximal: HeightHeightHeightHeightheight-1), the column index grows to the right (maximal: WidthWidthWidthWidthwidth-1).

The parameter MachineMachineMachineMachinemachine 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” or the “screen”, respectively, 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 FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow can be used to determine the father window for the window to be opened. In case the control 'father' is set via set_checkset_checkset_checkSetCheckSetCheck, FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow relates to the ID of a HALCON window, otherwise (set_check('~father')) it relates to the ID of an operating system window. If FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow is passed the value 0 or 'root', then under Windows and Unix the desktop and the root window become the father window, respectively. In this case, the value of the control 'father' (set via set_checkset_checkset_checkSetCheckSetCheck) is irrelevant.

Position and size of a window may change during runtime of a program. This may be achieved by calling set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, but also through external interferences (window manager). In the latter case the operator set_window_extentsset_window_extentsset_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_stringwrite_stringWriteStringWriteString and you may overwrite it by performing set_fontset_fontset_fontSetFontSetFont after calling open_textwindowopen_textwindowopen_textwindowOpenTextwindowOpenTextwindow. 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>)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_fontquery_fontQueryFontQueryFont).

You may set the color of the font (write_stringwrite_stringwrite_stringWriteStringWriteString, read_stringread_stringread_stringReadStringReadString) by calling set_colorset_colorset_colorSetColorSetColor, set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi, set_grayset_grayset_graySetGraySetGray or set_pixelset_pixelset_pixelSetPixelSetPixel. Calling set_insertset_insertset_insertSetInsertSetInsert specifies how the text or the graphics, respectively, is combined with the content of the image repeat memory. So you may achieve by calling, e.g., set_insertset_insertset_insertSetInsertSetInsert(::'not':) to eliminate the font after writing text twice at the same position.

Normally every output (e.g., write_stringwrite_stringwrite_stringWriteStringWriteString, disp_regiondisp_regiondisp_regionDispRegionDispRegion, disp_circledisp_circledisp_circleDispCircleDispCircle, etc.) in a window is terminated by a “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 there is a mouse operator 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")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 you use a textual window, e.g., as a parent window for other windows, you may suppress the security mechanism for it and save the necessary memory at the same moment. You achieve this before opening the window by calling set_system(::'backing_store','false':)set_system("backing_store","false")set_system("backing_store","false")SetSystem("backing_store","false")SetSystem("backing_store","false").

Difference: graphical window - textual window

The parameter ModeModeModeModemode specifies the mode of the window. It can have following values:

'visible':

Normal mode for textual windows: The window is created according to the parameters and all inputs and outputs are possible.

'invisible':

Invisible windows are not displayed in the display. Parameters like RowRowRowRowrow, ColumnColumnColumnColumncolumn, BorderWidthBorderWidthBorderWidthBorderWidthborderWidth, BorderColorBorderColorBorderColorBorderColorborderColor, BackgroundColorBackgroundColorBackgroundColorBackgroundColorbackgroundColor and FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow do not have any meaning. Output to these windows has no effect. Input (read_stringread_stringread_stringReadStringReadString, mouse, etc.) is not possible. You may use these windows to query representation parameter for an output device without opening a (visible) window. General queries are, e.g., query_colorquery_colorquery_colorQueryColorQueryColor and get_string_extentsget_string_extentsget_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. Parameters like BorderColorBorderColorBorderColorBorderColorborderColor and BackgroundColorBackgroundColorBackgroundColorBackgroundColorbackgroundColor do not have any meaning. 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 RowRowRowRowrow, ColumnColumnColumnColumncolumn, BorderWidthBorderWidthBorderWidthBorderWidthborderWidth, BorderColorBorderColorBorderColorBorderColorborderColor, BackgroundColorBackgroundColorBackgroundColorBackgroundColorbackgroundColor and FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow do not have any meaning. You may use buffer windows, if you prepare output (in the background) and copy it finally with copy_rectanglecopy_rectanglecopy_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 have to keep in mind that parameters like RowRowRowRowrow, ColumnColumnColumnColumncolumn, WidthWidthWidthWidthwidth and HeightHeightHeightHeightheight are restricted by the output device. Is a father window (FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow <> 'root') specified, then the coordinates are relative to this window.

Parallelization

Parameters

RowRowRowRowrow (input_control)  rectangle.origin.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Row index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Row Row Row Row row (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Row >= 0

ColumnColumnColumnColumncolumn (input_control)  rectangle.origin.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Column Column Column Column column (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: Column >= 0

WidthWidthWidthWidthwidth (input_control)  rectangle.extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Window's width.

Default value: 256

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

Minimum increment: 1

Recommended increment: 1

Restriction: Width > 0

HeightHeightHeightHeightheight (input_control)  rectangle.extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Window's height.

Default value: 256

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

Minimum increment: 1

Recommended increment: 1

Restriction: Height > 0

BorderWidthBorderWidthBorderWidthBorderWidthborderWidth (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Window border's width.

Default value: 2

Typical range of values: 0 ≤ BorderWidth BorderWidth BorderWidth BorderWidth borderWidth (lin)

Minimum increment: 1

Recommended increment: 1

Restriction: BorderWidth >= 0

BorderColorBorderColorBorderColorBorderColorborderColor (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Window border's color.

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

BackgroundColorBackgroundColorBackgroundColorBackgroundColorbackgroundColor (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Background color.

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

FatherWindowFatherWindowFatherWindowFatherWindowfatherWindow (input_control)  pointer HTupleHTupleVARIANTHtuple (integer / string) (IntPtr / IntPtr) (Hlong / char*) (Hlong / BSTR) (Hlong / char*)

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

Default value: 0

Restriction: FatherWindow >= 0

ModeModeModeModemode (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Window mode.

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

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

MachineMachineMachineMachinemachine (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Computer name, where the window has to be opened or empty string.

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

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (output_control)  window HWindow, HTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Window identifier.

Example (HDevelop)

open_textwindow(0,0,900,600,1,'black','slate blue','root','visible', \
                '',WindowHandle)
open_textwindow(10,10,300,580,3,'red','blue',Father,'visible', \
                '',WindowHandle)
open_window(10,320,570,580,Father,'visible','',WindowHandle)
set_color(WindowHandle,'red')
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
repeat
get_mposition(WindowHandle,Row,Column,Button)
get_grayval(Image,Row,Column,Gray)
write_string(WindowHandle,['  Position (',Row,',',Column,')  '])
write_string(WindowHandle,['Gray value (',Gray,')  '])
new_line(WindowHandle)
until(Button = 4)
close_window(WindowHandle)
clear_obj(Image)

Example (C)

open_textwindow(0,0,900,600,1,"black","slate blue","root","visible",
                "",&WindowHandle1) ;
open_textwindow(10,10,300,580,3,"red","blue",Father,"visible",
                "",&WindowHandle2) ;
open_window(10,320,570,580,Father,"visible","",&WindowHandle) ;
set_color(WindowHandle,"red") ;
read_image(&Image,"monkey") ;
disp_image(Image,WindowHandle) ;
create_tuple(&String,1) ;
do {
  get_mposition(WindowHandle,&Row,&Column,&Button) ;
  get_grayval(Image,Row,Column,&Gray) ;
  sprintf(buf,"Position( %d,%d ) ",Row,Column) ;
  set_s(String,buf,0) ;
  T_fwrite_string(String) ;
  new_line(WindowHandle) ;
}
while(Button < 4) ;
close_window(WindowHandle) ;
clear_obj(Image) ;

Example (HDevelop)

open_textwindow(0,0,900,600,1,'black','slate blue','root','visible', \
                '',WindowHandle)
open_textwindow(10,10,300,580,3,'red','blue',Father,'visible', \
                '',WindowHandle)
open_window(10,320,570,580,Father,'visible','',WindowHandle)
set_color(WindowHandle,'red')
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
repeat
get_mposition(WindowHandle,Row,Column,Button)
get_grayval(Image,Row,Column,Gray)
write_string(WindowHandle,['  Position (',Row,',',Column,')  '])
write_string(WindowHandle,['Gray value (',Gray,')  '])
new_line(WindowHandle)
until(Button = 4)
close_window(WindowHandle)
clear_obj(Image)

Example (HDevelop)

open_textwindow(0,0,900,600,1,'black','slate blue','root','visible', \
                '',WindowHandle)
open_textwindow(10,10,300,580,3,'red','blue',Father,'visible', \
                '',WindowHandle)
open_window(10,320,570,580,Father,'visible','',WindowHandle)
set_color(WindowHandle,'red')
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
repeat
get_mposition(WindowHandle,Row,Column,Button)
get_grayval(Image,Row,Column,Gray)
write_string(WindowHandle,['  Position (',Row,',',Column,')  '])
write_string(WindowHandle,['Gray value (',Gray,')  '])
new_line(WindowHandle)
until(Button = 4)
close_window(WindowHandle)
clear_obj(Image)

Example (HDevelop)

open_textwindow(0,0,900,600,1,'black','slate blue','root','visible', \
                '',WindowHandle)
open_textwindow(10,10,300,580,3,'red','blue',Father,'visible', \
                '',WindowHandle)
open_window(10,320,570,580,Father,'visible','',WindowHandle)
set_color(WindowHandle,'red')
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
repeat
get_mposition(WindowHandle,Row,Column,Button)
get_grayval(Image,Row,Column,Gray)
write_string(WindowHandle,['  Position (',Row,',',Column,')  '])
write_string(WindowHandle,['Gray value (',Gray,')  '])
new_line(WindowHandle)
until(Button = 4)
close_window(WindowHandle)
clear_obj(Image)

Result

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

Possible Predecessors

reset_obj_dbreset_obj_dbreset_obj_dbResetObjDbResetObjDb

Possible Successors

set_colorset_colorset_colorSetColorSetColor, query_window_typequery_window_typequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionset_tpositionSetTpositionSetTposition, set_tshapeset_tshapeset_tshapeSetTshapeSetTshape, set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsget_window_extentsGetWindowExtentsGetWindowExtents, query_colorquery_colorquery_colorQueryColorQueryColor, set_checkset_checkset_checkSetCheckSetCheck, set_systemset_systemset_systemSetSystemSetSystem

Alternatives

open_windowopen_windowopen_windowOpenWindowOpenWindow

See also

write_stringwrite_stringwrite_stringWriteStringWriteString, read_stringread_stringread_stringReadStringReadString, new_linenew_linenew_lineNewLineNewLine, get_string_extentsget_string_extentsget_string_extentsGetStringExtentsGetStringExtents, get_tpositionget_tpositionget_tpositionGetTpositionGetTposition, set_colorset_colorset_colorSetColorSetColor, query_window_typequery_window_typequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionset_tpositionSetTpositionSetTposition, set_tshapeset_tshapeset_tshapeSetTshapeSetTshape, set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsget_window_extentsGetWindowExtentsGetWindowExtents, query_colorquery_colorquery_colorQueryColorQueryColor, set_checkset_checkset_checkSetCheckSetCheck, set_systemset_systemset_systemSetSystemSetSystem

Module

Foundation


Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH