Opened 3 years ago

Closed 7 months ago

Last modified 7 months ago

#13945 closed defect (fixed)

Pressing Esc in a modal dialog with an autocomplete window shown dismisses the dialog instead of the autocomplete window

Reported by: PB Owned by:
Priority: normal Milestone:
Component: wxMSW Version:
Keywords: char-hook Cc:
Blocked By: Blocking:
Patch: yes

Description

How to reproduce:

  1. Invoke a dialog than can be closed by pressing <Esc> that has a text control with an autocompleter (e.g. wxDirPickerCtrl).
  2. Type something into the control so that autocomplete window pops up.
  3. Attempt to dismiss the the autocomplete window by pressing Esc.
  4. Instead of closing the autocomplete window, the whole dialog goes away.

I find this behaviour rather unintuitive and even annoying and this is not how it behaves in native Windows applications when using SHAutocomplete() on an edit control.

Tested with:
Windows XP
wxWidgets rev. 70543
VC++ 2008 Express

I created a patch to the minimal sample to demonstrate the issue; when running it type an "a" into the edit box and press <Esc> once the autocomplete window shows.

Attachments (2)

Autocompleter_minimal.cpp.patch download (7.2 KB) - added by PB 3 years ago.
textentry.cpp.patch download (1.6 KB) - added by zhchbin 7 months ago.
Trap Escape Key when the autocomplete drop-down list is currently displayed

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by PB

comment:1 Changed 3 years ago by vadz

  • Keywords char-hook added
  • Status changed from new to confirmed

We need to have some way of testing whether the autocomplete popup is shown. Not sure how to do it unfortunately...

comment:2 Changed 7 months ago by ericj

For reference: I think the code from this page may hold the key for a possible solution:
http://microsoft.public.win32.programmer.ui.narkive.com/RY1tqBx8/iautocomplete
( search for "GetDropDownStatus" )

comment:3 Changed 7 months ago by vadz

Yes, indeed, thanks! And notice that IAutoCompleteDropDown::GetDropDownStatus() is documented now so we definitely should use it.

comment:4 Changed 7 months ago by zhchbin

  • Patch set

Hi vadz,

Please take a look at the patch I just added. In this patch, escape key is trapped when the autocomplete drop-down list is currently displayed. My first try. :)

Changed 7 months ago by zhchbin

Trap Escape Key when the autocomplete drop-down list is currently displayed

comment:5 Changed 7 months ago by vadz

Excellent, thanks! I'm going to commit this soon.

comment:6 Changed 7 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [76096]) Fix handling of Esc while an auto-complete drop down is open in wxMSW.

Just close the drop down instead of closing the dialog the text control using
this auto-complete drop down is in, as this was completely unexpected and
counter-intuitive.

Closes #13945.

comment:7 Changed 7 months ago by VZ

(In [76097]) Fix handling of Esc while an auto-complete drop down is open in wxMSW.

Just close the drop down instead of closing the dialog the text control using
this auto-complete drop down is in, as this was completely unexpected and
counter-intuitive.

Closes #13945.

Note: See TracTickets for help on using tickets.