Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#15235 closed enhancement (fixed)

Add wxFileDialog::GetCurrentlySelectedFilename() and support for update UI events for wxFileDialog extra controls

Reported by: cgodkin Owned by:
Priority: normal Milestone: 2.9.5
Component: GUI-all Version: stable-latest
Keywords: file dialog Cc:
Blocked By: Blocking:
Patch: yes


As discussed on the wx-users mailing list here!topic/wx-users/SFNYnT_US9I

I've added a new function GetCurrentlySelectedFilename() to wxFileDialog for wxGTK and wxMSW. This function returns the file that the dialog currently indicates but has not selected with "Ok."

This can be used in an UpdateUI callback that the user may add to any extra controls added to the wxFileDialog.

In addition, UpdateUI events were not delivered to the extra controls. I've added support for doing so for both platforms as well.

I've updated the interface/filedlg.h file as well.

Attachments (1)

filedlg.patch download (5.5 KB) - added by cgodkin 5 years ago.
Patch implementing wxFileDialog changes

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by cgodkin

Patch implementing wxFileDialog changes

comment:1 Changed 5 years ago by troelsk

Maybe implement & document this method on both platforms

virtual void SelectionChanged (const wxString &filename);

(and drop MSWOnSelChange)

comment:2 Changed 5 years ago by VZ

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

(In [74071]) Add wxFileDialog::GetCurrentlySelectedFilename().

Also send wxEVT_UPDATE_UI events for the extra controls in wxFileDialog.

The combination of these changes allows extra controls to update their state
depending on the current selection in the dialog. Show a simple example of
doing it in the dialogs sample.

Closes #15235.

comment:3 Changed 4 years ago by cgodkin

Just a comment:

I realized today that I failed to implement GetCurrentlySelectedFilename() for the generic file dialog.

If anyone is interested, it's simple to do since wxGenericFileDialog() already has a GetPath() method that returns exactly the right thing already.

Note: See TracTickets for help on using tickets.