mail-archives/mono-bugs/2008-September/079294.html

292 строки
5.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 425725] New: RichTextBox - Firing of Events differs to MS
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20425725%5D%20New%3A%20RichTextBox%20-%20Firing%20of%20Events%0A%09differs%20to%20MS&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="079575.html">
<LINK REL="Next" HREF="079312.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 425725] New: RichTextBox - Firing of Events differs to MS</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20425725%5D%20New%3A%20RichTextBox%20-%20Firing%20of%20Events%0A%09differs%20to%20MS&In-Reply-To="
TITLE="[Mono-bugs] [Bug 425725] New: RichTextBox - Firing of Events differs to MS">bugzilla_noreply at novell.com
</A><BR>
<I>Fri Sep 12 01:59:53 EDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="079575.html">[Mono-bugs] [Bug 425724] XML signed with HMAC-SHA256 unsupported
</A></li>
<LI>Next message: <A HREF="079312.html">[Mono-bugs] [Bug 425725] RichTextBox - Firing of Events differs to MS
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#79294">[ date ]</a>
<a href="thread.html#79294">[ thread ]</a>
<a href="subject.html#79294">[ subject ]</a>
<a href="author.html#79294">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="https://bugzilla.novell.com/show_bug.cgi?id=425725">https://bugzilla.novell.com/show_bug.cgi?id=425725</A>
User <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">johnm at hlaustralia.com.au</A> added comment
<A HREF="https://bugzilla.novell.com/show_bug.cgi?id=425725#c1">https://bugzilla.novell.com/show_bug.cgi?id=425725#c1</A>
Summary: RichTextBox - Firing of Events differs to MS
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">johnm at hlaustralia.com.au</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
Found By: ---
Created an attachment (id=239208)
--&gt; (<A HREF="https://bugzilla.novell.com/attachment.cgi?id=239208">https://bugzilla.novell.com/attachment.cgi?id=239208</A>)
Proposed Fix
Description of Problem:
The TextChanged and SelectionChanged events do not execute in the same order to
the Microsoft .NET framework.
Additionally Appending Text should not fire the SelectionChanged event at all.
using System;
using System.Windows.Forms;
public class test
{
static void Main ()
{
Form f = new Form ();
RichTextBox rtb = new RichTextBox();
Button b = new Button();
b.Text = &quot;Append&quot;;
b.Parent = f;
b.Click += delegate { rtb.Text += &quot;a&quot;; };
b.Top = rtb.Height + 10;
rtb.SelectionChanged += new EventHandler(rtb_SelectionChanged);
rtb.TextChanged += delegate { Console.WriteLine(&quot;Text
Changed&quot;);};
rtb.Parent = f;
f.Load += delegate { };
Application.Run (f);
}
static void rtb_SelectionChanged(object sender, EventArgs e)
{
Console.WriteLine(String.Format(&quot;Selection: {0} Length: {1}&quot;,
(sender as RichTextBox).SelectionStart,(sender as
RichTextBox).SelectionLength));
}
}
If you execute the above program and manually enter 123 into the text box you
should get the following message on the console.
Test #1
Actual Results:
Text Changed
Selection: 1 Length: 0
Text Changed
Selection: 2 Length: 0
Text Changed
Selection: 3 Length: 0
Expected Results:
Selection: 1 Length: 0
Text Changed
Selection: 2 Length: 0
Text Changed
Selection: 3 Length: 0
Text Changed
Test #2
If you use the Append Button
Actual Results:
Selection: 0 Length: 0
Text Changed
Expected Results:
Text Changed
How often does this happen?
Every Time.
Additional Information:
I have attached a diff which fixes what is described above, not sure about how
a test case can be constructed.
--
Configure bugmail: <A HREF="https://bugzilla.novell.com/userprefs.cgi?tab=email">https://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="079575.html">[Mono-bugs] [Bug 425724] XML signed with HMAC-SHA256 unsupported
</A></li>
<LI>Next message: <A HREF="079312.html">[Mono-bugs] [Bug 425725] RichTextBox - Firing of Events differs to MS
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#79294">[ date ]</a>
<a href="thread.html#79294">[ thread ]</a>
<a href="subject.html#79294">[ subject ]</a>
<a href="author.html#79294">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>