setdlgpos
ダイアログボックスの表示位置を設定する。
setdlgpos [<x> <y> [<position> [<offset x> <offset y>]]]
パラメータ
- 整数 <x>
- ダイアログボックス左上隅の X 座標。
- 整数 <y>
- ダイアログボックス左上隅の Y 座標。
- 整数 <position>
- ダイアログボックスの表示位置。
1 : ディスプレイの左上
2 : ディスプレイの右上
3 : ディスプレイの左下
4 : ディスプレイの右下
5 : ディスプレイの中央
6 : 端末のウインドウの左上
7 : 端末のウインドウの右上
8 : 端末のウインドウの左下
9 : 端末のウインドウの右下
10 : 端末のウインドウの中央 - 整数 <offset x>
- <position> で指定した表示位置の X 座標補正値
- 整数 <offset y>
- <position> で指定した表示位置の Y 座標補正値
返り値
- 無し
解説
"inputbox", "listbox", "messagebox", "passwordbox", "statusbox", "yesnobox" コマンドで表示されるダイアログボックスとエラーダイアログの表示位置を変更する。
また、ステータスダイアログボックスが表示されている場合、setdlgpos コマンドはそのダイアログボックスを移動させる。
ダイアログがディスプレイからはみ出す場合は、ディスプレイ内に移動される。
座標の単位はポイント。
- setdlgpos
パラメータ省略時の表示位置は、メインディスプレイ(プライマリディスプレイ 以下略)の中央となる。 - setdlgpos <x> <y>
<x> と <y> でダイアログボックス左上隅の座標 (x,y) を指定する。
<x> と <y> は、ペアで指定しなければならない。
原点 (0,0)はメインディスプレイ左上隅。 - setdlgpos <x> <y> <position>
- <position> が 1 から 5 の場合
マクロがウインドウとリンクされている場合は、端末のウインドウが表示されているディスプレイにダイアログボックスを表示する。
マクロがウインドウとリンクされていない場合は、メインディスプレイにダイアログボックスを表示する。
ダイアログボックスの表示位置は、<position> で指定した場所となり、<x> <y> は無視される。 - <position> が 6 から 10 の場合
マクロがウインドウとリンクされている場合は、端末のウインドウが表示されているディスプレイにダイアログボックスを表示する。
マクロがウインドウとリンクされている場合の表示位置は、<position> で指定した場所となる。
マクロがウインドウとリンクされていない、もしくは、ウインドウが最小化状態または非表示状態の場合は、メインディスプレイにダイアログボックスを表示する。
この場合の表示位置は <x> <y> 座標となる。
- <position> が 1 から 5 の場合
- setdlgpos <x> <y> <position> <offset x> <offset y>
ダイアログボックスの表示位置は、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