確認ダイアログを表示し、ボタンで選択させる
作者: 小見 拓
—
最終変更
2012年01月08日 12時12分
確認ダイアログを表示し、ボタンで選択させる
- ダイアログの表示と、選択値の取得
:let choice = confirm("This is message. Which is your selection ?", "A answer\nB answer\nC answer") :if choice == 0 :echo "user cancel daialog." :elseif choice == 1 :echo "user select 'A answer'." :elseif choice == 2 :echo "user select 'B answer'." :elseif choice == 3 :echo "user select 'C answer'." :else :echo "ERROR" :endif
- 「&」で、回答候補にショートカットキーを設定
:let choice = confirm("This is message. Which is your selection ?", "&A answer\n&B answer\n&C answer") :if choice == 0 :echo "user cancel daialog." :elseif choice == 1 :echo "user select 'A answer'." :elseif choice == 2 :echo "user select 'B answer'." :elseif choice == 3 :echo "user select 'C answer'." :else :echo "ERROR" :endif "# => A、B、Cのどれかを押すだけで、選択したことになる
- ダイアログのボタンを縦一列に配置
:let user_option = &guioptions :set guioptions+=v :let choice = confirm("This is message. Which is your selection ?", "A answer\nB answer\nC answer") :if choice == 0 :echo "user cancel daialog." :elseif choice == 1 :echo "user select 'A answer'." :elseif choice == 2 :echo "user select 'B answer'." :elseif choice == 3 :echo "user select 'C answer'." :else :echo "ERROR" :endif :let &guioptions = user_option
- ダイアログのボタンを横一列に配置
:let user_option = &guioptions :set guioptions-=v :let choice = confirm("This is message. Which is your selection ?", "A answer\nB answer\nC answer") :if choice == 0 :echo "user cancel daialog." :elseif choice == 1 :echo "user select 'A answer'." :elseif choice == 2 :echo "user select 'B answer'." :elseif choice == 3 :echo "user select 'C answer'." :else :echo "ERROR" :endif :let &guioptions = user_option
Recent Comments
ありがとうございます!
http://nanasi.jp/articles/howto/editing/visualcursor-endtoend.html · 8 years ago
知りませんでした。有難うございました。
http://nanasi.jp/articles/howto/file/open-with-format.html · 9 years ago
<c-f>1ページ分、下にスクロールする<c-b>1ページ分、上にスクロールする
どっちも逆です。
http://nanasi.jp/articles/howto/user-manual/user-manual-motion.html · 10 years ago
set 使用時に : で閉じるのを忘れて右往左往してました。
http://nanasi.jp/articles/howto/file/modeline.html · 11 years ago
やっぱり日本語の方が早いっす。
http://nanasi.jp/articles/howto/help/help_ja.html · 12 years ago