setdlgpos

Sets the position of dialog box.

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

Parameters

integer <x>
X coordinate of the top-left corner of the dialog box.
integer <y>
Y coordinate of the top-left corner of the dialog box.
integer <position> (version 5.4 or later)
Display position of the dialog box.
1 : Top-left of the display.
2 : Top-right of the display.
3 : Bottom-left of the display.
4 : Bottom-right of the display.
5 : Center of the display.
6 : Top-left of the Tera Term VT window.
7 : Top-right of the Tera Term VT window.
8 : Bottom-left of the Tera Term VT window.
9 : Bottom-right of the Tera Term VT window.
10 : Center of the Tera Term VT window.
integer <offset x> (version 5.4 or later)
X coordinate adjustment value for the display position specified by <position>.
integer <offset y> (version 5.4 or later)
Y coordinate adjustment value for the display position specified by <position>.

Return Value

No return value.

Remarks

Change the display position of the dialog boxes and the error dialog shown by the "inputbox", "listbox", "messagebox", "passwordbox", "statusbox", "yesnobox".
If the status dialog box is displayed, the setdlgpos command will move that dialog box.
If the dialog extends beyond the display, it will be moved within the display.(version 4.105 or later)
The unit is pixels.

  1. setdlgpos (version 4.105 or later)
    When the parameter is omitted, the display position will be centered on the main display (the primary display)."
  2. setdlgpos <x> <y>
    Specify the coordinates (x,y) of the top-left corner of the dialog box using <x> and <y>.
    <x> and <y> must be specified as a pair.
    The origin (0,0) is the top-left corner of the main display.
  3. setdlgpos <x> <y> <position> (version 5.4 or later)
  4. setdlgpos <x> <y> <position> <offset x> <offset y> (version 5.4 or later)
    The display position of the dialog box will be the location obtained by adding <offset x> <offset y> to the display position (x,y coordinates) specified by setdlgpos <x> <y> <position>.
    <offset x> and <offset y> must be specified as a pair.
    When specifying negative values, please refer to the Note on negative integer constants.

Example

; Message box at the upper left corner.
setdlgpos 0 0
messagebox 'Message' 'Title'

; Open the status box.
setdlgpos 0 200
statusbox 'Message' 'Title'

; Moves the status box.
for i 0 200
  setdlgpos i 200
next

; Message box at the top-left of the VT window.
setdlgpos 0 0 6
messagebox 'top-left' 'VT window'

; Message box at the top-right offset 10px of the display.
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

See also