From b0a8b8607962081e87716ab0dfbca2439953f420 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Wed, 4 Feb 2009 22:13:12 -0700 Subject: Modified the NPC string and integer classes to automatically take focus to the input fields. Now the only NPC dialog which isn't completely navigatable by the keyboard alone is the NPC list dialog (seems to have regressed slightly recently). Signed-off-by: Ira Rice --- src/gui/npcintegerdialog.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/gui/npcintegerdialog.cpp') diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 4444e04b..c58fc460 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -32,9 +32,10 @@ NpcIntegerDialog::NpcIntegerDialog(): Window(_("NPC Number Request")) { + mValueField = new IntTextField(); + mDecButton = new Button("-", "decvalue", this); mIncButton = new Button("+", "incvalue", this); - mValueField = new IntTextField(); okButton = new Button(_("OK"), "ok", this); cancelButton = new Button(_("Cancel"), "cancel", this); resetButton = new Button(_("Reset"), "reset", this); @@ -56,9 +57,6 @@ NpcIntegerDialog::NpcIntegerDialog(): reflowLayout(175, 0); setLocationRelativeTo(getParent()); - - mValueField->setActionEventId("valuefield"); - mValueField->addKeyListener(this); } void NpcIntegerDialog::setRange(const int min, const int max) @@ -105,3 +103,13 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) mValueField->reset(); } } + +bool NpcIntegerDialog::isInputFocused() +{ + return mValueField->isFocused(); +} + +void NpcIntegerDialog::requestFocus() +{ + mValueField->requestFocus(); +} -- cgit v1.2.3-70-g09d2