Skip to content

open_textwindowOpenTextwindowOpenTextwindowopen_textwindowT_open_textwindow🔗

説明🔗

open_textwindowOpenTextwindowOpenTextwindowopen_textwindowT_open_textwindow — テキストウインドウを開く。

警告🔗

open_textwindowOpenTextwindow は、現在では使用されず、 下位互換性 維持のためだけに提供されます。 新しいアプリケーションでは、代わりに open_windowOpenWindow を使用 するようにしてください。

書式🔗

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 )

説明🔗

open_textwindowOpenTextwindow は、テキスト入出力用ならびに画像出力を行う ために使用する新しいテキストウインドウを開きます。同じウインドウ ID WindowHandlewindowHandlewindow_handle を使用すると、すべての出力( write_stringWriteString, read_stringReadString, disp_regionDispRegion など)は このウインドウに出力されます。

マウスカーソルのほかに、テキストウインドウはテキストカーソルを所有 します。テキストカーソルは、現在の書き込み位置(より正確には、出力 文字列の左下角)を示しています。テキストカーソルの位置は、アンダー スコアあるいは他のタイプで表示できます。(この表示は無効であるかも しれません。(= デフォルト設定) set_tshapeSetTshape); cf. set_tshapeSetTshape). オペレーター set_tpositionSetTposition あるいは get_tpositionGetTposition を呼ぶことによって、カーソル位置を設定したり現在位置を読み取ったり することができます。

テキストウインドウを開いた直後は、カーソルの位置が (H,0) に設定さ れています。H は descender より小さいデフォルトフォントの高さを 示します。しかし、カーソルそのものは表示されません。カーソルが表示 されるのは、ウインドウの左上隅から文字を書き始めた後です。

query_colorQueryColor を呼ぶことによって、背景と画像のエッジの色を問 い合わせることができます。同様に、ウインドウタイプ ‘invisible’ に おける query_colorQueryColor を使うことができます。 出力中 (write_stringWriteString)、texttt{set_check(::’~text’:)} を呼ぶことによって、ウインドウ枠からはみ出す文字をクリッピングする ように設定できます。 これにより、テキストが枠からはみ出したというエラーメッセージを出さ ないようにできます。

ウインドウの座標の原点は左上コーナ- (座標: (0,0)) です。行インデ ックスは下方へ向かって増加し (最大: Heightheightheight-1)、列インデッ クスは右へ向かって増加します。(最大: Widthwidthwidth-1)

パラメーター Machinemachinemachine は、ウインドウを開こうとしているコン ピュータ名を示しています。X ウインドウの場合は、TCP-IP のみがその 名前を決めます。DEC-Net は、さらに名前の後にコロンを追加します。“ server” または “screen” は指定されません。 空の文字列が入力されると、環境変数 DISPLAY が適用されます。それ は、対象のコンピュータを示しています。この場合、その名前は通常どお り :0.0 で示されます。

'WIN32-Window'"WIN32-Window"または'X-Window'"X-Window"のウインドウの場合、 FatherWindowfatherWindowfather_window パラメーターを使用して、開くウインドウの親ウインドウを 決定するために使用することができます。コントロール ‘father’ を set_checkSetCheck を利用し設定した場合、FatherWindowfatherWindowfather_window は HALCON ウインドウの ID でなくてはなりません。そうでなければ、(texttt{set_check(::’~father’:)}) オペレーティング システムのウインドウ ID となりえます。 FatherWindowfatherWindowfather_window が値 0 もしくは ‘root’ と指定される場合、 Windows もしくは Unix系システムでは、デスクトップとルートウインドウがそれぞ れの親ウインドウになります。この場合、コントロール ‘father’( set_checkSetCheck により設定)は無関係です。この呼び出しはFatherWindowfatherWindowfather_windowが 有効なハンドルであり、組み込まれたHALCONウインドウが利用されるまで消去されない ことが保証されている必要があります。

ウインドウの位置と大きさはプログラムの実行中に変化するかも しれません。 これは、set_window_extentsSetWindowExtents を呼び出すことによって行われま すが、外部インターフェース(ウインドウマネージャ)を通しても行なう ことができます。後者の場合、オペレーター set_window_extentsSetWindowExtents が利用可能です。

ウインドウを開くと、デフォルトフォントが割り当てられます。 write_stringWriteString のようなオペレーターと関連して使用されるか、 open_textwindowOpenTextwindow を呼び出した後に set_fontSetFont を実行す ることで、フォントを上書きすることもあります。一方で、ウインドウ( また、その後に開くどんなウインドウにおいても)を開く前に、 set_system(::'default_font',<Fontname>:) を呼び出すことに よって、初期フォントを指定することもできます(query_fontQueryFont を参照してください)。

フォントのカラーを設定(write_stringWriteString、 read_stringReadString)するには、set_colorSetColor、 set_rgbSetRgb、 set_hsiSetHsi、または ~ set_graySetGray を 呼び出します。

通常、ウインドウ内のすべての出力(例えば、write_stringWriteString, disp_regionDispRegion, disp_circleDispCircle など)は、“flush”を呼び 出すことによって終了します。これは、出力オペレーターを終了した後、 ディスプレイ上で見ることのできるデータを生成します。しかし、すべて の場合において、これが必要とは限りません。特に、もし永続する出力タ スクがある場合や、マウスの処理がアクティブである場合などです。した がって、十分なデータが利用できるまで、データを保持するためには非常 に有効(すなわち、高速)です。 set_system(::'flush_graphic','false':).を呼び出すことで、 この動作を終了することもできます。

ウインドウの内容は(それが特別なドライバソフトによってサポートされ ている場合)通常、保存されます。 例えば、ウインドウが他のウインド ウで隠される場合、そのウインドウの内容が保存されます。しかし、これ は、すべての場合に必要とは限りません。 他のウインドウの親ウインドウとして、テキストウインドウを使用する場 合、セキュリティ機能がはぶかれ、同時に必要なメモリが保存されること もあります。これは、 set_system(::'backing_store','false':) を呼び出すことによ ってウインドウを開く前実施します。

相違:グラフィカルウィンドウ - テキストウィンドウ

  • グラフィカルウィンドウ(open_windowOpenWindow)と対照的に、開いて いる間に、テキストウィンドウに追加のパラメーター(color, edge) を指定できます。

  • テキストウィンドウは、ユーザーデータの入力のみに使用するとよいで しょう(read_stringReadString)。

  • テキストウィンドウを使用すると、画像、領域、およびグラフィックス の出力が末尾でクリッピングされます。これに対し、グラフィカルウィ ンドウを使用すると、末尾がズームされます。

  • 座標系(get_mbuttonGetMbutton または get_mpositionGetMposition を使用 するなど) は、画像サイズに依存しない表示座標で構成されます。最大 座標は、ウィンドウ - 1 のサイズに等しくなります。これに対し、グ ラフィカルウィンドウ(open_windowOpenWindow)は常に、画像フォーマ ットに対応する座標系を使用します。

パラメーター Modemodemode はウインドウのモードを指定します。 それは以下に示す値をもつことができます。

注意🔗

Rowrowrow, Columncolumncolumn, Widthwidthwidth, Heightheightheight の ようなパラメーターは出力デバイスによって制限を受けることを心に留め ておく必要があります。親ウインドウ(FatherWindowfatherWindowfather_window \(<>\) ’ root’)が指定されると、その座標はこのウインドウに相対的となりま す。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

このオペレータはハンドルを返します。このハンドルタイプのインスタンスの状態は、特定のオペレータにおいては、入力パラメータとして使われている場合であっても変更されることがあります。

パラメーター🔗

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

上左隅の行座標

初期値: 00
値域: Row (lin)
最小増分: 1
推奨増分: 1

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

左上隅の列座標

初期値: 00
値域: Column (lin)
最小増分: 1
推奨増分: 1

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

ウインドウの幅

初期値: 256256
値域: 0 ≤ Width (lin)
最小増分: 1
推奨増分: 1

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

ウインドウの高さ

初期値: 256256
値域: 0 ≤ Height (lin)
最小増分: 1
推奨増分: 1

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

ウインドウ境界の幅

初期値: 22
値域: 0 ≤ BorderWidth (lin)
最小増分: 1
推奨増分: 1

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

ウインドウ境界の色

初期値: 'white'"white"

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

背景色

初期値: 'black'"black"

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

親ウインドウのウインドウ ID。表示のために ‘root’ または 0 を指定できます。

初期値: 00
制限: FatherWindow >= 0

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

ウインドウモード

初期値: 'visible'"visible"
値のリスト: 'buffer', 'invisible', 'transparent', 'visible'"buffer", "invisible", "transparent", "visible"

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

ウインドウを開くコンピュータ名もしくは空の文字列

初期値: ''""

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

ウインドウハンドル

例🔗

(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)\;

結果🔗

パラメーターの値が正しい場合、open_textwindowOpenTextwindow は値 2 (H_MSG_TRUE) を 返します。 必要に応じて、例外が発生します。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

reset_obj_dbResetObjDb

後処理の候補

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

他の選択候補

open_windowOpenWindow

関連項目

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

モジュール🔗

Foundation