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:21 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
Old 01-06-2005, 03:17 PM   #2
Pete
Guest
 
Posts: n/a
Default Re: is it the biggest bug in winform?!

Have you tried focusing the active form?

private void button1_Click(object sender, System.EventArgs e)
{
Form activeChild = this.ActiveMdiChild;
activeChild.Focus();

//shows the active windows' caption here
MessageBox.Show("button1 clicked in "+ this.Text );
}



"YangHua" <yanghua94@online.sh.cn.bad> wrote in message
news:eKmA$toZFHA.3840@tk2msftngp13.phx.gbl...
| 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
Old 01-06-2005, 03:30 PM   #3
Pete
Guest
 
Posts: n/a
Default Re: is it the biggest bug in winform?!

Oversight:

Actually, the 'this' keyword has to be amended to refer to the parent form because button_1 sits in
the child form.

Form activeChild = this.Parent.ActiveMdiChild;
activeChild.Focus();

/Pete.




"Pete" <Pete@noPete.com> wrote in message news:%23TyZrSrZFHA.3328@TK2MSFTNGP09.phx.gbl...
| Have you tried focusing the active form?
|
| private void button1_Click(object sender, System.EventArgs e)
| {
| Form activeChild = this.ActiveMdiChild;
| activeChild.Focus();
|
| //shows the active windows' caption here
| MessageBox.Show("button1 clicked in "+ this.Text );
| }
|
|
|
| "YangHua" <yanghua94@online.sh.cn.bad> wrote in message
| news:eKmA$toZFHA.3840@tk2msftngp13.phx.gbl...
|| 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
Old 01-06-2005, 03:43 PM   #4
Armin Zingler
Guest
 
Posts: n/a
Default Re: is it the biggest bug in winform?!

"YangHua" <yanghua94@online.sh.cn.bad> schrieb
> 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.




I remember this issue has already been mentioned some time ago. Anybody
knows it's been fixed in Beta2/Framework 2.0?

Armin

  Reply With Quote
Old 02-06-2005, 04:41 AM   #5
YangHua
Guest
 
Posts: n/a
Default this bug is very serious

Because we are developing a database application with a lot of forms
inherited from a single base data entry form that has
'&add','&edit','&delete;' and so on buttons,
this problem is very critical if the user press 'D' or 'Alt-D' when he wants
to delete the record
in the activeform but actually delete the records in another opened child
form!

Tony

"Armin Zingler" <az.nospam@freenet.de> ????
news:ucvRj8rZFHA.1148@tk2msftngp13.phx.gbl...
> "YangHua" <yanghua94@online.sh.cn.bad> schrieb
> > 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.

>
>
>
> I remember this issue has already been mentioned some time ago. Anybody
> knows it's been fixed in Beta2/Framework 2.0?
>
> Armin
>



  Reply With Quote
Old 02-06-2005, 04:50 AM   #6
YangHua
Guest
 
Posts: n/a
Default Re: is it the biggest bug in winform?!

Dear Armin

I searched the web and found no solution but the same bug description here

http://www.msusenet.com/archive/ind...1869738247.html

Regards
Tony

"Armin Zingler" <az.nospam@freenet.de> ????
news:ucvRj8rZFHA.1148@tk2msftngp13.phx.gbl...
> "YangHua" <yanghua94@online.sh.cn.bad> schrieb
> > 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.

>
>
>
> I remember this issue has already been mentioned some time ago. Anybody
> knows it's been fixed in Beta2/Framework 2.0?
>
> Armin
>



  Reply With Quote
Old 03-06-2005, 12:17 AM   #7
webmasta
Guest
 
Posts: n/a
Default Re: is it the biggest bug in winform?!

You keep dwelling on 'bug', have you even tried focusing the ActiveMdiChild as was suggested
earlier? We have a similar mdi setup and all access keys work as they should on/from the active
window... in any mdi application it is prudent to make sure that commands are sent to the active
window simply by Focus() or BringToFront() even if its already in front.

~webmasta.




"YangHua" <yanghua94@online.sh.cn.bad> wrote in message
news:OMEndZyZFHA.3356@TK2MSFTNGP15.phx.gbl...
| Dear Armin
|
| I searched the web and found no solution but the same bug description here
|
| http://www.msusenet.com/archive/ind...1869738247.html
|
| Regards
| Tony
|
| "Armin Zingler" <az.nospam@freenet.de> ????
| news:ucvRj8rZFHA.1148@tk2msftngp13.phx.gbl...
| > "YangHua" <yanghua94@online.sh.cn.bad> schrieb
| > > 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.
| >
| >
| >
| > I remember this issue has already been mentioned some time ago. Anybody
| > knows it's been fixed in Beta2/Framework 2.0?
| >
| > Armin
| >
|
|

  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