3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TeraTermマクロのlistboxウィンドウの横幅を広げる方法

Posted at

問題点 : listboxで長い文字列が見切れてしまう

TeraTermのマクロのlistboxの不便な点として「ウィンドウサイズを変更することができず、選択対象として長い文字列を表示すると見切れてしまうため、文字列全体を読むためにはマウスで横スクロールするしかない」という点が挙げられます。

見切れてしまうコードの例

; リストボックスの中身を定義
strdim LISTITEM 6
LISTITEM[0] = "192.168.0.1 - some_descriptions_about_this_host"
LISTITEM[1] = "192.168.0.2 - some_descriptions_about_this_host"
LISTITEM[2] = "192.168.0.3 - some_descriptions_about_this_host"
LISTITEM[3] = "192.168.0.4 - some_descriptions_about_this_host"
LISTITEM[4] = "192.168.0.5 - some_descriptions_about_this_host"
LISTITEM[5] = "192.168.0.6 - some_descriptions_about_this_host"

; リストボックス表示
listbox "Select login server" "Select server" LISTITEM

実行結果
image.png

意外とストレスフルなこの問題点については改善要望のチケットも上がっているものの、開発状況的に改善される見込みはなさそうなのが現状です。

解決策 : <messages> 引数に長文を入れてウィンドウサイズを引き伸ばす

アドホックな解決策ですが、listboxの第一引数である<messages>を長文にすることでウィンドウサイズが横に引き伸ばされるため、リスト部分の横幅を広げることができます。

見切れてしまうコードの例

; リストボックスの中身を定義
strdim LISTITEM 6
LISTITEM[0] = "192.168.0.1 - some_descriptions_about_this_host"
LISTITEM[1] = "192.168.0.2 - some_descriptions_about_this_host"
LISTITEM[2] = "192.168.0.3 - some_descriptions_about_this_host"
LISTITEM[3] = "192.168.0.4 - some_descriptions_about_this_host"
LISTITEM[4] = "192.168.0.5 - some_descriptions_about_this_host"
LISTITEM[5] = "192.168.0.6 - some_descriptions_about_this_host"

; リストボックス表示
listbox "Select login server----------------------------------------------------" "Select server" LISTITEM

実行結果
image.png

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?