セクション

確認ダイアログを表示し、ボタンで選択させる

作者: 小見 拓 最終変更 2009年12月06日 05時51分

確認ダイアログを表示し、ボタンで選択させる

  • ダイアログの表示と、選択値の取得
: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
ドキュメントアクション
コメント
{no}. {user_name}  {posted}
{message_body}

(必須)
氏名を入力してください。
Eメールアドレスを入力してください。
(必須)
送りたいメッセージを入力してください。
Recent Comment
EnhCommentify.vim : 複数のファイルタイプに対応したソースコメントアウト、コメントアウト解除スクリプト — 名無しのvim使い
==> anonymous [2010/03/22 06:32:47]
vimエディタから外部のプログラムやコマンドを実行する。 — 名無しのvim使い
==> 通りすがりnoです [2010/02/04 18:28:49]
==> 通りすがりの者です [2010/02/04 18:30:28]
==> 通りすがりのものです2 [2010/02/04 18:41:38]
PCに昨日初めてさわった人でもわかるgvim超々入門 (Windows、vim6) — 名無しのvim使い
==> anonymous [2009/11/05 11:57:11]
==> 佐藤 よしお [2009/11/27 15:53:34]
==> 小見 拓 [2009/11/27 18:40:42]
==> anonymous [2010/01/06 19:48:09]
Update Feed
RSS1.0 / RSS2.0 / ATOM