PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms is it the biggest bug in winform?!

Reply

is it the biggest bug in winform?!

 
Thread Tools Rate Thread
Old 01-06-2005, 10:19 AM   #1
YangHua
Guest
 
Posts: n/a
Default is it the biggest bug in winform?!


The bug is that in a MDI windows application, when we create serveral
instances of forms with the same shortcut key(I.E. 3 forms, each has a
button texted "&Add"), when we press alt-A, we can not be sure which will
form receive the key stroke. I don't know if it has been fixed in dotNET
Framework SPs, but it is still real existing in my computer and my
workmates'.

in the following code sample, click the button1 serveral times to create
multipile instance of Form2, then try to press 'Alt-A' or 'Alt-M', you can
see what a strange behavior winForm brings to us.

sample code

MDIform, put a button and add the code below:

private void button1_Click(object sender, System.EventArgs e)
{
Form2 f=new Form2();
f.Text="Window" + Convert.ToString(this.MdiChildren.Length+1);
f.MdiParent=this;

f.Show();

}
}

create a Form2,put an '&Add' button and a '&Modify' button

this.button1.Text = "&Add";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Text = "&Modify";
this.button2.Click += new System.EventHandler(this.button2_Click);

private void button1_Click(object sender, System.EventArgs e)
{
//shows the active windows' caption here
MessageBox.Show("button1 clicked in "+ this.Text );
}

private void button2_Click(object sender, System.EventArgs e)
{
MessageBox.Show("button2 clicked in "+ this.Text );
}


Any good idea or suggestion will be appreciated, thanks!

Tony Yang


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off