Opened 17 months ago

Closed 17 months ago

Last modified 2 months 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

Description

As discussed on the wx-users mailing list here

https://groups.google.com/forum/?fromgroups#!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 17 months ago.
Patch implementing wxFileDialog changes

Download all attachments as: .zip

Change History (4)

Changed 17 months ago by cgodkin

Patch implementing wxFileDialog changes

comment:1 Changed 17 months ago by troelsk

Maybe implement & document this method on both platforms

virtual void SelectionChanged (const wxString &filename);

(and drop MSWOnSelChange)

comment:2 Changed 17 months 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 2 months 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.