[Mono-bugs] [Bug 325809] New: [Patch] Control: Clicking causes the control to be selected.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Sep 17 16:36:53 EDT 2007
https://bugzilla.novell.com/show_bug.cgi?id=325809
Summary: [Patch] Control: Clicking causes the control to be
selected.
Product: Mono: Class Libraries
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at ximian.com
ReportedBy: georgegiolfan at yahoo.com
QAContact: mono-bugs at ximian.com
Found By: ---
Created an attachment (id=172864)
--> (https://bugzilla.novell.com/attachment.cgi?id=172864)
Possible fix. I have only checked a simple real application.
Description of Problem:
Clicking a control apparently selects it (on MWF). On .NET Framework 2.0 this
does not happen.
Steps to reproduce the problem:
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
static class Test
{
static void Main ()
{
new TestForm ().Show ();
}
}
class TestForm : Form
{
FocusTestControl c1 = new FocusTestControl ();
FocusTestControl c2 = new FocusTestControl ();
public TestForm ()
{
c1.Text = "1";
c2.Text = "2";
c2.Dock = DockStyle.Fill;
Controls.AddRange (new Control [] { c1, c2 });
}
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
Debug.Assert (!c1.Focused, "1");
Debug.Assert (!c2.Focused, "2");
Debug.Assert (ActiveControl == null, "3");
Debug.Assert (c1.SelectCalls == 0, "4");
Debug.Assert (c2.SelectCalls == 0, "5");
c2.SimulateClick ();
Debug.Assert (!c1.Focused, "1 1");
Debug.Assert (!c2.Focused, "2 1");
Debug.Assert (ActiveControl == null, "3 1");
Debug.Assert (c1.SelectCalls == 0, "4 1");
Debug.Assert (c2.SelectCalls == 0, "5 1");
}
}
class FocusTestControl : Control
{
public int SelectCalls;
public void SimulateClick ()
{
const int WM_LBUTTONDOWN = 0x0201;
Message m = new Message ();
m.Msg = WM_LBUTTONDOWN;
Debug.Assert (CanSelect);
WndProc (ref m);
}
protected override void Select (bool directed, bool forward)
{
base.Select (directed, forward);
SelectCalls++;
}
}
Additional Information:
This seems to be done on purpose (see the patch). I am guessing there is a
reason for it (maybe this is the behavior of an older version) since it is not
a result of a recent change. Maybe someone who has an older .NET Framework
installed can check this to see if it is a 2.0 change.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list