From dbca29bb2b210865f9ee913c1803fd2b850a14d8 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 4 Dec 1997 02:33:17 +0000 Subject: [PATCH] simplify popbox traversal git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@262 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/PopBox.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/PopBox.c b/src/PopBox.c index 31949a83a9..01adcd1ae4 100644 --- a/src/PopBox.c +++ b/src/PopBox.c @@ -210,9 +210,10 @@ static void selectCB (Widget w, XtPointer cd, XtPointer cb ) } /********************************************************************\ - * fix traversal by assuming that menu up due to a tab key - * is a traversal change. Return focus to the matrix widget, - * instead of letting it default to the next tab group. + * fix traversal by going back to the register window + * when the pull-down menu goes away. We do NOT want to + * go to the default next tab group, which is probably + * some button not in theregister window. \********************************************************************/ static void dropDownCB (Widget w, XtPointer cd, XtPointer cb ) @@ -222,17 +223,37 @@ static void dropDownCB (Widget w, XtPointer cd, XtPointer cb ) XmComboBoxDropDownCallbackStruct *ddcb = (XmComboBoxDropDownCallbackStruct *) cb; + + if (XmCR_HIDE_LIST == ddcb->reason) { + XmProcessTraversal(ab->reg, XmTRAVERSE_CURRENT); + } + +#ifdef USE_COMPLEX_TRAVERSAL_LOGIC + /* continue traversal only under certain special curcumstances */ if (XmCR_HIDE_LIST == ddcb->reason) { if (ddcb->event) { + + /* don't leave if only a focus-out */ + if (FocusOut == ddcb->event->type) { + XmProcessTraversal(ab->combobox, XmTRAVERSE_CURRENT); + } else + + /* if user selected something, then go to next cell */ + if (ButtonRelease == ddcb->event->type) { + XmProcessTraversal(ab->reg, XmTRAVERSE_CURRENT); + } else + + /* if user hit the tab key, go to next cell */ if ((KeyPress == ddcb->event->type) || (KeyRelease == ddcb->event->type)) { KeySym sim; XKeyEvent *kev = (XKeyEvent *) ddcb->event; sim = XLookupKeysym (kev, 0); - if (XK_Tab == sim) { + if (XK_Tab == sim) { /* did the user hit the tab key ?? */ XmProcessTraversal(ab->reg, XmTRAVERSE_CURRENT); } } } } +#endif /* USE_COMPLEX_TRAVERSAL_LOGIC */ } /************************* END OF FILE ******************************/