setdlgpos

ダイアログボックスの位置を設定する。

setdlgpos [<x> <y> [<position> [<offset x> <offset y>]]]

パラメータ

整数 <x>
ダイアログボックス左上隅の X 座標。
整数 <y>
ダイアログボックス左上隅の Y 座標。
整数 <position> (バージョン 5.4 以降)
ダイアログボックスの表示位置。
1 : ディスプレイの左上
2 : ディスプレイの右上
3 : ディスプレイの左下
4 : ディスプレイの右下
5 : ディスプレイの中央
6 : Tera Term の VT ウインドウの左上
7 : Tera Term の VT ウインドウの右上
8 : Tera Term の VT ウインドウの左下
9 : Tera Term の VT ウインドウの右下
10 : Tera Term の VT ウインドウの中央
整数 <offset x> (バージョン 5.4 以降)
<position> で指定した表示位置の X 座標補正値
整数 <offset y> (バージョン 5.4 以降)
<position> で指定した表示位置の Y 座標補正値

返り値

無し

解説

"inputbox", "listbox", "messagebox", "passwordbox", "statusbox", "yesnobox" コマンドで表示されるダイアログボックスとエラーダイアログの表示位置を変更する。
また、ステータスダイアログボックスが表示されている場合、setdlgpos コマンドはそのダイアログボックスを移動させる。
ダイアログがディスプレイからはみ出す場合は、ディスプレイ内に移動される。(バージョン 4.105以降)
座標の単位はピクセル。

  1. setdlgpos (バージョン 4.105以降)
    パラメータ省略時の表示位置は、メインディスプレイ(プライマリディスプレイ 以下略)の中央となる。
  2. setdlgpos <x> <y>
    <x> と <y> でダイアログボックス左上隅の座標 (x,y) を指定する。
    <x> と <y> は、ペアで指定しなければならない。
    原点 (0,0)はメインディスプレイ左上隅。
  3. setdlgpos <x> <y> <position> (バージョン 5.4 以降)
  4. setdlgpos <x> <y> <position> <offset x> <offset y> (バージョン 5.4 以降)
    ダイアログボックスの表示位置は、setdlgpos <x> <y> <position> の表示位置(x,y座標)に <offset x> <offset y> を加算した場所となる。
    <offset x> と <offset y> はペアで指定しなければならない。
    負の値を指定する場合は、負の整数定数についての注意を参照のこと。

; 左上の隅にダイアログボックス
setdlgpos 0 0
messagebox 'Message' 'Title'

; ステータスダイアログボックスを開く
setdlgpos 0 200
statusbox 'Message' 'Title'

; ステータスダイアログボックスを移動
for i 0 200
  setdlgpos i 200
next

; VTウィンドウの左上を基準に表示する
setdlgpos 0 0 6
messagebox 'top-left' 'VT window'

; ディスプレイの右上を基準に、下に10px、左に10pxに表示する
setdlgpos 0 0 2 (-10) 10
messagebox 'top-right offset 10px' 'Display'
strdim message_string_array 11
message_string_array[1]  = 'top-left of the display'
message_string_array[2]  = 'top-right of the display'
message_string_array[3]  = 'bottom-left of the display'
message_string_array[4]  = 'bottom-right of the display'
message_string_array[5]  = 'center of the display'
message_string_array[6]  = 'top-left of the VT window'
message_string_array[7]  = 'top-right of the VT window'
message_string_array[8]  = 'bottom-left of the VT window'
message_string_array[9]  = 'bottom-right of the VT window'
message_string_array[10] = 'center of the VT window'

strdim listbox_string_array 3
listbox_string_array[0] = 'Banana'
listbox_string_array[1] = 'Apple'
listbox_string_array[2] = 'Orange'

x = 0
y = 0
offset_x = 0
offset_y = 0

for position 1 10
  sprintf2 message 'setdlgpos %d %d %d %d %d\n(%s)' x y position offset_x offset_y message_string_array[position]
  strspecial message
  setdlgpos x y position offset_x offset_y
  statusbox   message 'statusbox'
  messagebox  message 'messagebox'
  yesnobox    message 'yesnobox'
  inputbox    message 'inputbox'
  passwordbox message 'passwordbox'
  listbox     message 'listbox' listbox_string_array
next

参照