[Mono-winforms-list] Error in (Save)FileDialog

Emery Conrad econrad at vt.edu
Tue Apr 25 09:44:25 EDT 2006


SaveFileDialog doesn't behave properly. It was relying on a selection to be
made in the FileView widget and was also not setting the name properly for
Save mode. The attached diff fixes these issues.

Emery

Here's the diff:

Index: mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
(revision 59817)
+++ mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
(working copy)
@@ -734,7 +734,7 @@

                void OnClickOpenSaveButton (object sender, EventArgs e)
                {
-                       if (mwfFileView.SelectedItems [0] != null) {
+                       if (fileDialogType == FileDialogType.OpenFileDialog&&
mwfFileView.SelectedItems [0] != null) {
                                string path =
Path.Combine(currentDirectoryName,
mwfFileView.SelectedItems [0].Text);
                                if (Directory.Exists (path)) {
                                        ChangeDirectory (null, path);
@@ -752,7 +752,7 @@
                                                        fileFromComboBox =
Path.Combine (currentDirectoryName, fileFromComboBox);

                                                FileInfo fileInfo = new
FileInfo (fileFromComboBox);
-                                               if (fileInfo.Exists)
+                                               if (fileInfo.Exists ||
fileDialogType == FileDialogType.SaveFileDialog)
                                                        currentFileName =
fileFromComboBox;
                                                else {
                                                        DirectoryInfo
dirInfo = new DirectoryInfo (fileFromComboBox);


--
Emery Conrad
Department of Mathematics
Virginia Tech
5076 Derring Hall
Blacksburg, VA 24061-0406
(540) 231-3324
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20060425/546c8ea4/attachment.html


More information about the Mono-winforms-list mailing list