Skip to content

open_textwindowOpenTextwindowOpenTextwindowopen_textwindowT_open_textwindow🔗

Short description🔗

open_textwindowOpenTextwindowOpenTextwindowopen_textwindowT_open_textwindow — Open a textual window.

Warning🔗

open_textwindowOpenTextwindow is obsolete and is only provided for reasons of backward compatibility. New applications should use the operator open_windowOpenWindow instead.

Signature🔗

open_textwindow( rectangle.origin.y Row, rectangle.origin.x Column, rectangle.extent.x Width, rectangle.extent.y Height, integer BorderWidth, string BorderColor, string BackgroundColor, pointer FatherWindow, string Mode, string Machine, out window WindowHandle )void 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, HTuple* WindowHandle )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 )def open_textwindow( row: int, column: int, width: int, height: int, border_width: int, border_color: str, background_color: str, father_window: Union[int, str], mode: str, machine: str ) -> HHandle

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 )

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

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

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

void HWindow::OpenTextwindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, Hlong BorderWidth, const wchar_t* BorderColor, const wchar_t* BackgroundColor, void* FatherWindow, const wchar_t* Mode, const wchar_t* Machine ) (Windows only)

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_textwindowOpenTextwindow 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_stringWriteString, read_stringReadString, disp_regionDispRegion, etc.) is redirected to this window, if the same logical window number WindowHandlewindowHandlewindow_handle 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_tshapeSetTshape). You may set or query the position by calling the operators set_tpositionSetTposition or get_tpositionGetTposition.

After you opened a textual window the position of the cursor is set to (H,0). Whereby H signifies 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_colorQueryColor. In the same way you may use query_colorQueryColor in a window of type ‘invisible’. During output (write_stringWriteString) you may set the clipping of text out of the window edges by calling texttt{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: Heightheightheight-1), the column index grows to the right (maximal: Widthwidthwidth-1).

The parameter Machinemachinemachine 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 :0.0.

For windows of type 'WIN32-Window'"WIN32-Window" and 'X-Window'"X-Window" the parameter FatherWindowfatherWindowfather_window can be used to determine the father window for the window to be opened. In case the control ‘father’ is set via set_checkSetCheck, FatherWindowfatherWindowfather_window must be the ID of a HALCON window, otherwise (texttt{set_check(::’~father’:)}) it can also be the ID of an operating system window. If FatherWindowfatherWindowfather_window 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_checkSetCheck) is irrelevant. The caller must ensure that FatherWindowfatherWindowfather_window is a valid handle and not destroyed as long as the embedded HALCON window is used.

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

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

You may set the color of the font (write_stringWriteString, read_stringReadString) by calling set_colorSetColor, set_rgbSetRgb, set_hsiSetHsi or set_graySetGray.

Normally every output (e.g., write_stringWriteString, disp_regionDispRegion, disp_circleDispCircle, 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 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':).

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':).

Difference: graphical window - textual window

  • In contrast to graphical windows (open_windowOpenWindow) you may specify more parameters (color, edge) for a textual window while opening it.

  • You may use textual windows only for input of user data (read_stringReadString).

  • Using textual windows, the output of images, regions and graphics is “clipped” at the edges. Whereas during the use of graphical windows the edges are “zoomed”.

  • The coordinate system (e.g., with get_mbuttonGetMbutton or get_mpositionGetMposition) consists of display coordinates independently of image size. The maximum coordinates are equal to the size of the window minus 1. In contrast to this, graphical windows (open_windowOpenWindow) use always a coordinate system, which corresponds to the image format.

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

Attention🔗

You have to keep in mind that parameters like Rowrowrow, Columncolumncolumn, Widthwidthwidth and Heightheightheight are restricted by the output device. Is a father window (FatherWindowfatherWindowfather_window \(<>\) ‘root’) specified, then the coordinates are relative to this window.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

Rowrowrow (input_control) rectangle.origin.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Row index of upper left corner.

Default: 00
Value range: Row (lin)
Minimum increment: 1
Recommended increment: 1

Columncolumncolumn (input_control) rectangle.origin.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column index of upper left corner.

Default: 00
Value range: Column (lin)
Minimum increment: 1
Recommended increment: 1

Widthwidthwidth (input_control) rectangle.extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Window’s width.

Default: 256256
Value range: 0 ≤ Width (lin)
Minimum increment: 1
Recommended increment: 1

Heightheightheight (input_control) rectangle.extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Window’s height.

Default: 256256
Value range: 0 ≤ Height (lin)
Minimum increment: 1
Recommended increment: 1

BorderWidthborderWidthborder_width (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Window border’s width.

Default: 22
Value range: 0 ≤ BorderWidth (lin)
Minimum increment: 1
Recommended increment: 1

BorderColorborderColorborder_color (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Window border’s color.

Default: 'white'"white"

BackgroundColorbackgroundColorbackground_color (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Background color.

Default: 'black'"black"

FatherWindowfatherWindowfather_window (input_control) pointer → (integer / string)HTuple (Hlong / HString)HTuple (IntPtr / IntPtr)Union[int, str]Htuple (Hlong / char*)

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

Default: 00
Restriction: FatherWindow >= 0

Modemodemode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Window mode.

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

Machinemachinemachine (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

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

Default: ''""

WindowHandlewindowHandlewindow_handle (output_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

Example🔗

(HDevelop)

open_textwindow(0,0,900,600,1,'black','slate blue','root','visible', \
              '',WindowHandle1)
open_textwindow(10,10,300,580,3,'red','blue',WindowHandle1,'visible', \
              '',WindowHandle2)
open_window(10,320,570,580,WindowHandle1,'visible','',WindowHandle)
set_color(WindowHandle,'red')
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
Button := 0
repeat
  try
      get_mposition(WindowHandle,Row,Column,Button)
      get_grayval(Image,Row,Column,Gray)
      write_string(WindowHandle2,['  Position (',Row,',',Column,')  '])
      write_string(WindowHandle2,['Gray value (',Gray,')  '])
      new_line(WindowHandle2)
  catch (Exception)
  endtry
until(Button == 4)
close_window(WindowHandle1)
(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)\;

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

reset_obj_dbResetObjDb

Possible successors

set_colorSetColor, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_tshapeSetTshape, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, query_colorQueryColor, set_checkSetCheck, set_systemSetSystem

Alternatives

open_windowOpenWindow

See also

write_stringWriteString, read_stringReadString, new_lineNewLine, get_string_extentsGetStringExtents, get_tpositionGetTposition, set_colorSetColor, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_tshapeSetTshape, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, query_colorQueryColor, set_checkSetCheck, set_systemSetSystem

Module🔗

Foundation