- wxFileDialog dialog(this, "Testing save file dialog", "", "",
- "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
- wxSAVE|wxOVERWRITE_PROMPT);
-
- if (dialog.ShowModal() == wxID_OK)
- {
- char buf[400];
- sprintf(buf, "%s, filter %d", (const char *)dialog.GetPath(), dialog.GetFilterIndex());
- wxMessageDialog dialog2(this, wxString(buf), "Selected path");
- dialog2.ShowModal();
- }
+ wxFileDialog dialog(this, "Testing open multiple file dialog",
+ "", "", wxFileSelectorDefaultWildcardStr,
+ wxMULTIPLE);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxArrayString paths, filenames;
+
+ dialog.GetPaths(paths);
+ dialog.GetFilenames(filenames);
+
+ wxString msg, s;
+ size_t count = paths.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ s.Printf(_T("File %d: %s (%s)\n"),
+ n, paths[n].c_str(), filenames[n].c_str());
+
+ msg += s;
+ }
+
+ wxMessageDialog dialog2(this, msg, "Selected files");
+ dialog2.ShowModal();
+ }
+}
+
+void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
+{
+ wxFileDialog dialog(this, "Testing save file dialog", "", "myletter.txt",
+ "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
+ wxSAVE|wxOVERWRITE_PROMPT);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxChar buf[400];
+ wxSprintf(buf, _T("%s, filter %d"), (const wxChar*)dialog.GetPath(), dialog.GetFilterIndex());
+ wxMessageDialog dialog2(this, wxString(buf), "Selected path");
+ dialog2.ShowModal();
+ }
+}
+
+void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
+{
+ // pass some initial dir to wxDirDialog
+ wxString dirHome;
+ wxGetHomeDir(&dirHome);
+
+ wxDirDialog dialog(this, "Testing directory picker", dirHome);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
+ dialog2.ShowModal();
+ }