Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11866 closed defect (fixed)


Reported by: troelsk Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: wxFileDialog wxFileSelectorEx wxFD_DEFAULT_STYLE wxDocManager Cc:
Blocked By: Blocking:
Patch: yes


The wxID_OPEN menu handler in wxDocManager ends up calling wxFileSelectorEx - without the wxFD_FILE_MUST_EXIST flag: the file dialog then accepts all and any text typed in. This is rather unconventional use of the file dialog.
The problem can be seen in the docview samples.

The problem comes down to the wxFD_DEFAULT_STYLE definition,
Rather odd that it isn't like this


  • One patch fixing wxFD_DEFAULT_STYLE
  • Another patch with a workaround in wxDocManager, if the wxFD_DEFAULT_STYLE definition for some reason is not to be changed.

Same problem exists in the stable branch.

Attachments (3)

filedlg-default-style.patch download (462 bytes) - added by troelsk 10 years ago.
docview-fileopen.patch download (673 bytes) - added by troelsk 10 years ago.
filedlg-default-style2.patch download (631 bytes) - added by troelsk 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by troelsk


Changed 10 years ago by troelsk


comment:1 Changed 10 years ago by vadz

  • Status changed from new to confirmed

I think changing wxFS_DEFAULT_STYLE is not a good idea as it would silently break any implementation of New... or Create... menu commands not specifying the style explicitly. I'll apply the second patch however, there is really no reason to AFAICS.


comment:2 Changed 10 years ago by VZ

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

(In [63784]) Only allow opening existing files in docview framework.

Use wxFD_FILE_MUST_EXIST when asking the user for the name of the file to

Closes #11866.

comment:3 Changed 10 years ago by troelsk

Unfortunately many more users are bound to be bitten by this.
Please consider applying patch #2, to at least make it more obvious what is going on.

Changed 10 years ago by troelsk


Note: See TracTickets for help on using tickets.