summaryrefslogtreecommitdiff
path: root/src/Fl_Search_Chooser.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-01-16 15:15:21 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-01-16 15:15:21 +0100
commitea65a7c0bcd3c8bf5c889b11141210b23b987916 (patch)
treebd4eb476eb16cdcceea74011e4e8334c53327673 /src/Fl_Search_Chooser.cxx
parentecab9550adb2ab019faaf74ba34e528f6a5bd474 (diff)
fix focus issue after choose viewpoint dialog
Diffstat (limited to 'src/Fl_Search_Chooser.cxx')
-rw-r--r--src/Fl_Search_Chooser.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx
index 0ef435d..0b3cc93 100644
--- a/src/Fl_Search_Chooser.cxx
+++ b/src/Fl_Search_Chooser.cxx
@@ -56,17 +56,18 @@ static void input_cb(Fl_Input* in, void*c) {
static void ok_cb(Fl_Input* in, void*c) {
Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
- sc->hide();
+ sc->close();
}
static void cancel_cb(Fl_Input* in, void*c) {
Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
sc->sb->deselect();
- sc->hide();
+ sc->close();
}
Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, title?title:"Choose") {
+ visible_focus = Fl::visible_focus();
Fl::visible_focus(0);
Fl_Group *g = new Fl_Group(10, 10, w() - 10, h() - 10);
sb = new Fl_Search_Browser(g->x(), g->y(), g->w() , g->h() - 100, NULL);
@@ -84,6 +85,12 @@ Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, ti
}
void
+Fl_Search_Chooser::close() {
+ hide();
+ Fl::visible_focus(visible_focus);
+}
+
+void
Fl_Search_Chooser::add(const char *t, void *d) {
sb->add(t, d);
}
@@ -108,10 +115,8 @@ Fl_Search_Chooser::handle(int event) {
if (key == FL_Up || key == FL_Down) {
return sb->handle(event);
} else if (key == FL_Enter) {
- hide();
- return 1;
+ close();
}
-
}
return Fl_Window::handle(event);