[Mono-winforms-list] Bug in System.Windows.Forms.Control:get_ContainsFocus ()?
PFJ
paul at all-the-johnsons.co.uk
Wed Jun 21 05:19:27 EDT 2006
Hi,
> mcs base.cs -r:System.Windows.Forms -r:System.Data -r:System.Drawing
>
> run mono base.exe
>
> Click on button1.
Code
8-->
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication4
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new testbutton();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(96, 32);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new
System.EventHandler(this.button1_Click);
this.button2.Location = new System.Drawing.Point(96, 80);
this.button2.Name = "button2";
this.button2.TabIndex = 1;
this.button2.Text = "button2";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 262);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
Console.Write(button2.Focused);
}
}
public class testbutton : System.Windows.Forms.Button
{
public testbutton()
{
}
public override bool Focused
{
get
{
return base.ContainsFocus;
}
}
}
}
<--8
ContainsFocus is working fine - as a quick test I altered button2 to be
a button and created a new Click event for it as well as altering the
button1 ClickEvent - they now just return base.ContainsFocus to the
console.
It looks more to me that there is a problem accessing something which is
not properly created (testbutton()).
TTFN
Paul
--
"Logic, my dear Zoe, is merely the ability to be wrong with authority" -
Dr Who
More information about the Mono-winforms-list
mailing list