On 12/5/2017 11:03 AM, Ken Brown wrote:
On 12/5/2017 7:58 AM, Jon Turney wrote:
Please apply.

Done.

The search textbox on the package chooser page needs the same fix.

It's not immediately clear to me how to do this, since I don't know what the default pushbutton should be while the user is typing in the search box.

One possibility is to convert the label "Search" to the left of the box to a SEARCH pushbutton, whose effect is to call OnTimerMessage().  If we make this the default, then pressing Enter will cause the search filter to immediately take effect, which is probably what the user expects.

Something like the attached? This might not be quite right, because the previous default button is never restored. I'm not sure how important that is.

Ken

From e7f96c2db95c8bb4e9eb3a91730db7328b6e7d12 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbr...@cornell.edu>
Date: Tue, 5 Dec 2017 12:21:12 -0500
Subject: [PATCH] Fix response to Enter in the chooser textbox

Make Enter cause the search filter to immediately take effect.
Previously Enter would cause NEXT.
---
 choose.cc  |  5 +++++
 res.rc     | 10 +++++-----
 resource.h |  1 +
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/choose.cc b/choose.cc
index 1bc4c0b..0c6704f 100644
--- a/choose.cc
+++ b/choose.cc
@@ -386,6 +386,7 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 
   if (code == EN_CHANGE && id == IDC_CHOOSE_SEARCH_EDIT)
     {
+      SendMessage (GetHWND (), DM_SETDEFID, (WPARAM) IDC_CHOOSE_DO_SEARCH, 0);
       SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL);
       return true;
     }
@@ -402,6 +403,10 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
       }
       break;
 
+    case IDC_CHOOSE_DO_SEARCH:
+      SendMessage (GetHWND (), WM_TIMER, (WPARAM) timer_id, 0);
+      break;
+
     case IDC_CHOOSE_KEEP:
       if (IsButtonChecked (id))
         keepClicked();
diff --git a/res.rc b/res.rc
index a4d7e70..8839196 100644
--- a/res.rc
+++ b/res.rc
@@ -323,11 +323,11 @@ END
 #define SETUP_VIEW_W           (20)
 #define SETUP_VIEWLIST_X               (SETUP_VIEW_X + SETUP_VIEW_W + 2)
 #define SETUP_VIEWLIST_W               (60)
-#define SETUP_SEARCH_X         (SETUP_VIEWLIST_X + SETUP_VIEWLIST_W + 2)
+#define SETUP_SEARCH_X         (SETUP_SEARCHTEXT_X + SETUP_SEARCHTEXT_W + 2)
 #define SETUP_SEARCH_W         (32)
-#define SETUP_SEARCHTEXT_X     (SETUP_SEARCH_X + SETUP_SEARCH_W + 2)
+#define SETUP_SEARCHTEXT_X     (SETUP_VIEWLIST_X + SETUP_VIEWLIST_W + 2)
 #define SETUP_SEARCHTEXT_W     (60)
-#define SETUP_CLEAR_X          (SETUP_SEARCHTEXT_X + SETUP_SEARCHTEXT_W + 2)
+#define SETUP_CLEAR_X          (SETUP_SEARCH_X + SETUP_SEARCH_W + 2)
 #define SETUP_CLEAR_W          (22)
 
 IDD_CHOOSE DIALOG DISCARDABLE  0, 0, SETUP_STANDARD_DIALOG_DIMS
@@ -340,10 +340,10 @@ BEGIN
                     SETUP_VIEW_W, 10
     COMBOBOX        IDC_CHOOSE_VIEW, SETUP_VIEWLIST_X, 30, SETUP_VIEWLIST_W, 
84,
                     CBS_DROPDOWNLIST | WS_TABSTOP
-    RTEXT           "&Search", IDC_STATIC, SETUP_SEARCH_X, 33, SETUP_SEARCH_W,
-                    10, SS_CENTERIMAGE, WS_EX_RIGHT
     EDITTEXT        IDC_CHOOSE_SEARCH_EDIT, SETUP_SEARCHTEXT_X, 30,
                     SETUP_SEARCHTEXT_W, 14, ES_AUTOHSCROLL
+    PUSHBUTTON      "&Search", IDC_CHOOSE_DO_SEARCH, SETUP_SEARCH_X, 30,
+                    SETUP_SEARCH_W, 14
     PUSHBUTTON      "&Clear", IDC_CHOOSE_CLEAR_SEARCH, SETUP_CLEAR_X, 30,
                     SETUP_CLEAR_W, 14
     CONTROL         "&Keep", IDC_CHOOSE_KEEP, "Button", BS_AUTORADIOBUTTON
diff --git a/resource.h b/resource.h
index a2e867f..79b876d 100644
--- a/resource.h
+++ b/resource.h
@@ -177,3 +177,4 @@
 #define IDC_FILE_INUSE_HELP               592
 #define IDC_NET_DIRECT_LEGACY             593
 #define IDC_DOWNLOAD_EDIT                 594
+#define IDC_CHOOSE_DO_SEARCH              595
-- 
2.15.0

Reply via email to