Author: ivanz
Date: 2008-02-16 17:02:27 -0500 (Sat, 16 Feb 2008)
New Revision: 95935
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2008-02-16 Ivan N. Zlatev <[EMAIL PROTECTED]>
* GridEntry.cs:
- Fix ValueText to not return null.
- Fix conversion error reporting to actually happen.
* PropertyGridView.cs: Set entry only if the text has changed.
[Fixes bug #362116]
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-16 22:01:05 UTC (rev 95934)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-16 22:02:27 UTC (rev 95935)
@@ -1,5 +1,13 @@
2008-02-16 Ivan N. Zlatev <[EMAIL PROTECTED]>
+ * GridEntry.cs:
+ - Fix ValueText to not return null.
+ - Fix conversion error reporting to actually happen.
+ * PropertyGridView.cs: Set entry only if the text has changed.
+ [Fixes bug #362116]
+
+2008-02-16 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
[Backport to 1.9]
* GridEntry.cs:
- Fix handling of a null current value.
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2008-02-16 22:01:05 UTC (rev 95934)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
2008-02-16 22:02:27 UTC (rev 95935)
@@ -191,7 +191,17 @@
}
public string ValueText {
- get { return ConvertToString (this.Value); }
+ get {
+ string text = null;
+ try {
+ text = ConvertToString (this.Value);
+ if (text == null)
+ text = String.Empty;
+ } catch {
+ text = String.Empty;
+ }
+ return text;
+ }
}
public override bool Select ()
@@ -423,19 +433,17 @@
conversionError = true;
}
if (conversionError) {
- // MS swallows those
- //
- // string valueText = ConvertToString
(value);
- // if (valueText != null) {
- // error = "Property value '" +
valueText + "' of '" +
- // PropertyDescriptor.Name
+ "' is not convertible to type '" +
- //
this.PropertyDescriptor.PropertyType.Name + "'";
- //
- // } else {
- // error = "Property value of '" +
- // PropertyDescriptor.Name
+ "' is not convertible to type '" +
- //
this.PropertyDescriptor.PropertyType.Name + "'";
- // }
+ string valueText = ConvertToString
(value);
+ if (valueText != null) {
+ error = "Property value '" +
valueText + "' of '" +
+ PropertyDescriptor.Name
+ "' is not convertible to type '" +
+
this.PropertyDescriptor.PropertyType.Name + "'";
+
+ } else {
+ error = "Property value of '" +
+ PropertyDescriptor.Name
+ "' is not convertible to type '" +
+
this.PropertyDescriptor.PropertyType.Name + "'";
+ }
return false;
}
}
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
2008-02-16 22:01:05 UTC (rev 95934)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
2008-02-16 22:02:27 UTC (rev 95935)
@@ -278,7 +278,7 @@
private bool TrySetEntry (GridEntry entry, object value)
{
- if (entry == null)
+ if (entry == null || grid_textbox.Text.Equals
(entry.ValueText))
return true;
if (entry.IsEditable || !entry.IsEditable &&
(entry.HasCustomEditor || entry.AcceptedValues != null) ||
@@ -289,7 +289,8 @@
if (!changed && error != null) {
if (property_grid.ShowError (error,
MessageBoxButtons.OKCancel) == DialogResult.Cancel)
UpdateItem (entry); // restore
value, repaint, etc
- return false;
+ else
+ return false;
}
}
return true;
@@ -382,7 +383,8 @@
return item;
}
- protected override void OnKeyDown (KeyEventArgs e) {
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
GridEntry selectedItem =
(GridEntry)property_grid.SelectedGridItem;
if (selectedItem == null) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches