Author: pbartok
Date: 2005-03-18 14:09:15 -0500 (Fri, 18 Mar 2005)
New Revision: 42004

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
Log:
2005-03-18  Peter Bartok  <[EMAIL PROTECTED]>

        * ComboBox.cs: Now also firing the OnKeyPress events for the embedded
          textbox
        * FileDialog.cs:
          - Made Open/Save button the accept button for FileDialog
          - Tied the cancel button to the IButtonControl cancel button
          - Save/Open now properly builds the pathname
          - Now handles user-entered text
          - Preventing crash on right-click if no item is selected
          - Fixed Text property, now uses contents of textbox
          - Fixed SelectedText property, now just returns the text part that
            is selected in the text box



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-18 18:56:09 UTC (rev 42003)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-18 19:09:15 UTC (rev 42004)
@@ -1,3 +1,17 @@
+2005-03-18  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * ComboBox.cs: Now also firing the OnKeyPress events for the embedded
+         textbox
+       * FileDialog.cs:
+         - Made Open/Save button the accept button for FileDialog
+         - Tied the cancel button to the IButtonControl cancel button
+         - Save/Open now properly builds the pathname
+         - Now handles user-entered text
+         - Preventing crash on right-click if no item is selected
+         - Fixed Text property, now uses contents of textbox
+         - Fixed SelectedText property, now just returns the text part that
+           is selected in the text box
+
 2005-03-18  Jackson Harper  <[EMAIL PROTECTED]>
 
        * ThemeWin32Classic.cs: Use the proper func for drawing the focus

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2005-03-18 18:56:09 UTC (rev 42003)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2005-03-18 19:09:15 UTC (rev 42004)
@@ -246,6 +246,7 @@
                                if (dropdown_style != 
ComboBoxStyle.DropDownList && textbox_ctrl == null) {
                                        textbox_ctrl = new TextBox ();
                                        textbox_ctrl.TextChanged += new 
EventHandler (OnTextChangedEdit);
+                                       textbox_ctrl.KeyPress += new 
KeyPressEventHandler(textbox_ctrl_KeyPress);
 
                                        if (IsHandleCreated == true) {
                                                Controls.Add (textbox_ctrl);
@@ -450,15 +451,13 @@
                                if (dropdown_style == 
ComboBoxStyle.DropDownList)
                                        return "";
                                        
-                               return textbox_ctrl.Text;
+                               return textbox_ctrl.SelectedText;
                        }
                        set {
-                               if (dropdown_style == 
ComboBoxStyle.DropDownList)
+                               if (dropdown_style == 
ComboBoxStyle.DropDownList) {
                                        return;
+                               }
                                
-                               if (textbox_ctrl.Text == value)
-                                       return;
-                                       
                                textbox_ctrl.SelectedText = value;
                        }
                }
@@ -518,9 +517,16 @@
                [Bindable (true)]
                [Localizable (true)]
                public override string Text {
-                       get { 
-                               if (SelectedItem != null) 
+                       get {
+                               if (dropdown_style != 
ComboBoxStyle.DropDownList) {
+                                       if (textbox_ctrl != null) {
+                                               return textbox_ctrl.Text;
+                                       }
+                               }
+
+                               if (SelectedItem != null)  {
                                        return SelectedItem.ToString ();
+                               }
                                                                
                                return base.Text;                               
                        }
@@ -856,6 +862,9 @@
                #endregion Public Methods
 
                #region Private Methods
+               private void textbox_ctrl_KeyPress(object sender, 
KeyPressEventArgs e) {
+                       OnKeyPress(e);
+               }
                
                // Calcs the text area size
                internal void CalcTextArea ()
@@ -1865,7 +1874,7 @@
                        }                       
 
                        #endregion Private Methods
-               }
+               }
        }
 }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2005-03-18 18:56:09 UTC (rev 42003)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2005-03-18 19:09:15 UTC (rev 42004)
@@ -462,11 +462,13 @@
                                menueToolBarButton = new ToolBarButton( );
                                fileTypeLabel = new Label( );
                                openSaveButton = new Button( );
+                               fileDialog.form.AcceptButton = openSaveButton;
                                helpButton = new Button( );
 //                             bigButtonToolBar = new ToolBar( );
                                buttonPanel = new ButtonPanel( this );
                                upToolBarButton = new ToolBarButton( );
                                cancelButton = new Button( );
+                               fileDialog.form.CancelButton = cancelButton;
                                imageListTopToolbar = new ImageList( );
 //                             imageListLeftToolbar = new ImageList( );
                                menueToolBarButtonContextMenu = new 
ContextMenu( );
@@ -756,10 +758,9 @@
                        
                        void OnClickOpenButton( object sender, EventArgs e )
                        {
+                               currentFileName = 
Path.Combine(currentDirectoryName, fileNameComboBox.Text.Trim());
                                Console.WriteLine( "OnClickOpenButton 
currentFileName: " + currentFileName );
                                
-                               currentFileName.Trim( );
-                               
                                if ( currentFileName.Length == 0 )
                                        return;
                                
@@ -1063,14 +1064,18 @@
                                
                                protected override void OnClick( EventArgs e )
                                {
-                                       ListViewItem listViewItem = 
SelectedItems[ 0 ];
+                                       ListViewItem listViewItem;
+
+                                       if (SelectedItems.Count > 0) {
+                                               listViewItem = SelectedItems[ 0 
];
+
+                                               FileStruct fileStruct = 
(FileStruct)fileDialogPanel.fileHashtable[ listViewItem.Text ];
                                        
-                                       FileStruct fileStruct = 
(FileStruct)fileDialogPanel.fileHashtable[ listViewItem.Text ];
-                                       
-                                       if ( fileStruct.attributes != 
FileAttributes.Directory )
-                                       {
-                                               
fileDialogPanel.FileNameComboBox.Text = listViewItem.Text;
-                                               fileDialogPanel.CurrentFileName 
= fileStruct.fullname;
+                                               if ( fileStruct.attributes != 
FileAttributes.Directory )
+                                               {
+                                                       
fileDialogPanel.FileNameComboBox.Text = listViewItem.Text;
+                                                       
fileDialogPanel.CurrentFileName = fileStruct.fullname;
+                                               }
                                        }
                                        
                                        base.OnClick( e );

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to