PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
is it the biggest bug in winform?!
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
is it the biggest bug in winform?!
![]() |
is it the biggest bug in winform?! |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 | | | |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 || || || | |
|
|
|
#4 |
|
Guest
Posts: n/a
|
"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 |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
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 | > | | |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

