Author: jpobst
Date: 2007-11-09 10:14:03 -0500 (Fri, 09 Nov 2007)
New Revision: 89319
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
Log:
2007-11-09 Jonathan Pobst <[EMAIL PROTECTED]>
* TextBoxBase.cs: Move handling of the enter key from KEYDOWN to CHAR
so that it can be canceled in KeyPress.
Fixes bug #340078.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-11-09 15:06:44 UTC (rev 89318)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-11-09 15:14:03 UTC (rev 89319)
@@ -1,3 +1,9 @@
+2007-11-09 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * TextBoxBase.cs: Move handling of the enter key from KEYDOWN to CHAR
+ so that it can be canceled in KeyPress.
+ Fixes bug #340078.
+
2007-11-08 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* ListView.cs: In ItemControl, reset mouse-handling related
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-11-09 15:06:44 UTC (rev 89318)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
2007-11-09 15:14:03 UTC (rev 89319)
@@ -1309,29 +1309,29 @@
return true;
}
- case Keys.Enter: {
- // ignoring accepts_return, fixes bug
#76355
- if (!read_only && document.multiline &&
(accepts_return || (FindForm() != null && FindForm().AcceptButton == null) ||
((Control.ModifierKeys & Keys.Control) != 0))) {
- Line line;
+ //case Keys.Enter: {
+ // // ignoring accepts_return, fixes bug
#76355
+ // if (!read_only && document.multiline
&& (accepts_return || (FindForm() != null && FindForm().AcceptButton == null)
|| ((Control.ModifierKeys & Keys.Control) != 0))) {
+ // Line line;
- if (document.selection_visible)
{
-
document.ReplaceSelection("\n", false);
- }
+ // if
(document.selection_visible) {
+ //
document.ReplaceSelection("\n", false);
+ // }
- line = document.CaretLine;
+ // line = document.CaretLine;
- document.Split
(document.CaretLine, document.CaretTag, document.CaretPosition);
- line.ending = LineEnding.Rich;
- document.InsertString (line,
line.text.Length,
-
document.LineEndingToString (line.ending));
- OnTextChanged(EventArgs.Empty);
+ // document.Split
(document.CaretLine, document.CaretTag, document.CaretPosition);
+ // line.ending = LineEnding.Rich;
+ // document.InsertString (line,
line.text.Length,
+ //
document.LineEndingToString (line.ending));
+ //
OnTextChanged(EventArgs.Empty);
- document.UpdateView (line,
document.Lines - line.line_no, 0);
- CaretMoved(this, null);
- return true;
- }
- break;
- }
+ // document.UpdateView (line,
document.Lines - line.line_no, 0);
+ // CaretMoved(this, null);
+ // return true;
+ // }
+ // break;
+ //}
case Keys.Tab: {
if (!read_only && accepts_tab &&
document.multiline) {
@@ -1435,6 +1435,28 @@
CaretMoved(this, null);
}
+ private void HandleEnter ()
+ {
+ // ignoring accepts_return, fixes bug #76355
+ if (!read_only && document.multiline && (accepts_return
|| (FindForm() != null && FindForm().AcceptButton == null) ||
((Control.ModifierKeys & Keys.Control) != 0))) {
+ Line line;
+
+ if (document.selection_visible)
+ document.ReplaceSelection ("\n", false);
+
+ line = document.CaretLine;
+
+ document.Split (document.CaretLine,
document.CaretTag, document.CaretPosition);
+ line.ending = LineEnding.Rich;
+ document.InsertString (line, line.text.Length,
document.LineEndingToString (line.ending));
+
+ OnTextChanged (EventArgs.Empty);
+
+ document.UpdateView (line, document.Lines -
line.line_no, 0);
+ CaretMoved (this, null);
+ }
+ }
+
protected override void SetBoundsCore (int x, int y, int width,
int height, BoundsSpecified specified)
{
// Make sure we don't get sized bigger than we want to
be
@@ -1517,7 +1539,8 @@
return;
} else if (ch == 8) {
HandleBackspace(false);
- }
+ } else if (ch == 13)
+ HandleEnter ();
return;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches