モーダルウィンドウでのデフォルトのボタン選択/ハイライトモーダルウィンドウで特定のボタンを選択ボタンとして設定して、Enter / Spaceを押したときにそのボタンを使用できるようにすることはできますか?
追加したサンプルスクリプトでは、モーダルウィンドウの「OK」ボタンをデフォルトで選択したいのですが、デフォルトではラジオボックス(この場合は「オプション1」)の最初の選択として設定されており、わかりません。それを変更する方法を。 新しいウィンドウ(デフォルトで選択)の最初の要素として[OK]ボタンをクリックする偽のボタンを作成することでこれを行うことができましたが、これは機能させるための少しハックな方法だと思います(サンプルスクリプトでコメントアウトされています)。
Names Default To Here(1);
okPushed = 0;
nw = New Window("Modal window", << modal, Show toolbars(0), Show menu(0),
//fakebutton = Button Box(" ",<< Style("underline"), << set function(ok_button << click)),
rb = Radio Box(
{"Option 1", "Option 2"}, << Set(2)
),
Panelbox("Actions",
Hlistbox(
ok_button = button box("OK", okPushed = 1; sel = rb << get selected),
cancel_button = button box("Cancel", okPushed = 0; stop();),
)
),
);
if(okPushed == 0, stop());
show(sel);
スクリプティングRe:モーダルウィンドウでのデフォルトのボタン選択/ハイライトウィンドウの上部に[OK]ボタンを配置できますか?
Re:モーダルウィンドウでのデフォルトのボタン選択/ハイライトはい...ここに例があります
Names Default To Here( 1 );
nw = New Window("At the Top", << modal,
v list box(
button box("OK", nw << close window ),
spacer box(size(0,25)),
text box(" at the bottom")
)
)
Re:モーダルウィンドウでのデフォルトのボタン選択/ハイライトボタンを上に移動することは、空のボタンを上に追加しないようにするための1つのオプションです。
簡単にテストすると、新しいウィンドウをモーダルにしない場合、Enterキーを押すと、ラジオボタンの最初のオプションではなくOKボタンが押されるようです。
Names Default To Here(1);
okPushed = 0;
nw = New Window("Modal window", Show toolbars(0), Show menu(0),
rb = Radio Box(
{"Option 1", "Option 2"}, << Set(2)
),
Panelbox("Actions",
Hlistbox(
ok_button = button box("OK", okPushed = 1; sel = rb << get selected; nw << close window;),
cancel_button = button box("Cancel", okPushed = 0; nw << close window;)
)
),
);
nw << on close(
if(okPushed == 0, show(sel, okPushed); stop(),
show(sel, okPushed);
);
);
Re:モーダルウィンドウでのデフォルトのボタン選択/ハイライト現在、fakebuttonを使用したオープニングメッセージに記載されているのと同じ回避策を使用しています。
Names Default To Here(1);
okPushed = 0;
nw = New Window("Modal window", << modal, Show toolbars(0), Show menu(0),
fakebutton = Button Box(" ",<< Style("underline"), << set function(ok_button << click)),
rb = Radio Box(
{"Option 1", "Option 2"}, << Set(2)
),
Panelbox("Actions",
Hlistbox(
ok_button = button box("OK", okPushed = 1; sel = rb << get selected),
cancel_button = button box("Cancel", okPushed = 0; stop();),
)
),
);
if(okPushed == 0, stop());
show(sel);また、これに似たものが回避策として使用される可能性がありますテキスト編集ボックスにフォーカスを設定する
また、新しい願いを作成しました: << SetFocusをインタラクティブな表示要素(TextEditBox、Button ...)で使用できるようにします