1

私のアプリケーションには、いくつかの設定ページがあります。それらのいくつかでは、ユーザーはいくつかの項目を編集する必要があります。ユーザーがEnterkey-KEY を使用すると、OK ボタンにフォーカスがあるため、設定ダイアログ全体が閉じます。

では、どうすればこの動作を無効にできますか?

ページ上の任意の項目にフォーカスを設定できますが、押すEnterとダイアログが強制的に閉じられます。

4

2 に答える 2

0

デフォルトの Dialog を拡張し、次のメソッドをオーバーライドします。

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // Its the same as super.createButtonsForButtonBar(), but makes no default buttons by sending false.
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
于 2013-06-25T11:44:58.270 に答える