public inbox for cygwin-apps-cvs@sourceware.org help / color / mirror / Atom feed
From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.882-16-ga7c7dea Date: Sat, 09 Dec 2017 13:11:00 -0000 [thread overview] Message-ID: <20171209131110.102681.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=a7c7dea653e9e5ccfe702a8d25dbcbd82a7f0beb commit a7c7dea653e9e5ccfe702a8d25dbcbd82a7f0beb Author: Ken Brown <kbrown@cornell.edu> Date: Tue Dec 5 12:21:12 2017 -0500 Fix response to enter in the chooser search textbox Make 'enter' after we've started typing into the search textbox cause the search filter to immediately take effect. We don't change the default control immediately on EN_SETFOCUS unless there is already text in the search textbox, so pressing 'enter' with the focus on the search textbox (the initial state of the dialog) without typing anything into the search textbox moves to the next page, as previously. Also improve a bit of debug output from ChooserPage::OnMessageCmd() v2: Explicitly add/remove the defpushbutton style from the "Next" button when the default button changes v3: Refine behaviour so default control is changed on EN_SETFOCUS if some search text is present. Diff: --- choose.cc | 39 ++++++++++++++++++++++++++++++++++++--- res.rc | 2 ++ resource.h | 1 + 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/choose.cc b/choose.cc index 1bc4c0b..c78f55d 100644 --- a/choose.cc +++ b/choose.cc @@ -381,12 +381,38 @@ bool ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) { #if DEBUG - Log (LOG_BABBLE) << "OnMesageCmd " << id << " " << hwndctl << " " << code << endLog; + Log (LOG_BABBLE) << "OnMessageCmd " << id << " " << hwndctl << " " << std::hex << code << endLog; #endif - if (code == EN_CHANGE && id == IDC_CHOOSE_SEARCH_EDIT) + if (id == IDC_CHOOSE_SEARCH_EDIT) { - SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL); + HWND nextButton = ::GetDlgItem(::GetParent(GetHWND()), 0x3024 /* ID_WIZNEXT */); + char buf[16]; + + if ((code == EN_CHANGE) || + ((code == EN_SETFOCUS) && GetWindowText(GetDlgItem(IDC_CHOOSE_SEARCH_EDIT), buf, 15))) + { + // when focus arrives at this control and it has some text in it, or + // when we change the text in it, change the default button to one + // which immediately applies the search filter + // + // (we don't do this when the focus is on this control but it's empty + // (the initial state of the dialog) so that enter in that state moves + // onto the next page) + SendMessage(GetHWND (), DM_SETDEFID, (WPARAM) IDC_CHOOSE_DO_SEARCH, 0); + SendMessage(nextButton, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); + } + if (code == EN_CHANGE) + { + // apply the search filter when we stop typing + SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL); + } + else if (code == EN_KILLFOCUS) + { + // when focus leaves this control, restore the normal default button + SendMessage(GetHWND (), DM_SETDEFID, (WPARAM) 0x3024 /* ID_WIZNEXT */, 0); + SendMessage(nextButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); + } return true; } else if (code == BN_CLICKED) @@ -402,6 +428,13 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code) } break; + case IDC_CHOOSE_DO_SEARCH: + // invisible pushbutton which is the default pushbutton while typing into + // the search textbox, so that 'enter' causes the filter to be applied + // immediately, rather than activating the next page + 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..901cf76 100644 --- a/res.rc +++ b/res.rc @@ -342,6 +342,8 @@ BEGIN CBS_DROPDOWNLIST | WS_TABSTOP RTEXT "&Search", IDC_STATIC, SETUP_SEARCH_X, 33, SETUP_SEARCH_W, 10, SS_CENTERIMAGE, WS_EX_RIGHT + CONTROL "Search ", IDC_CHOOSE_DO_SEARCH, "Button", BS_PUSHBUTTON | NOT + WS_VISIBLE, SETUP_SEARCH_X, 33, SETUP_SEARCH_W, 14 EDITTEXT IDC_CHOOSE_SEARCH_EDIT, SETUP_SEARCHTEXT_X, 30, SETUP_SEARCHTEXT_W, 14, ES_AUTOHSCROLL PUSHBUTTON "&Clear", IDC_CHOOSE_CLEAR_SEARCH, SETUP_CLEAR_X, 30, 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
reply other threads:[~2017-12-09 13:11 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20171209131110.102681.qmail@sourceware.org \ --to=jturney@sourceware.org \ --cc=cygwin-apps-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).