B
Brian Swanson
Hi,
We've been bitten by a change in behavior between .NET 1.0 and .NET 1.1.
Specifically: We determine in the Leave event what control to move to next.
E.g., We call textbox4.Focus() in the leave event of TextBox1.
In .NET 1.0 you would get 1 leave event when pressing the TAB key and **no
extra leave event** when calling .Focus() from within the already running
Leave event
What's different in .NET 1.1 is that if the control that I'm calling Focus
on (TextBox4) was not **already next** in the tab sequence from TextBox1, I
will get a SECOND, undesirable, extra Leave event on TextBox1. This has
broken our application and is causing a significant headache with our
migration to the new framework.
Is there a reason that this is happening, and is there a way for us to fix
this without undertaking a massive code change?
By the way, a similar reply to another thread provided by "Ying-Shen
Yu[MSFT]" suggested that putting focus() code inside of Focus events can
mess up the Windows message loop. I'm not sure if this example falls under
the same category. We've tried putting the call to Focus() on a call to
Control.Invoke (via the ThreadPool.QueueWorkItem) but this has two problems:
a) It defers execution of the Focus() event until after the Leave event has
finished executing
b) More seriously, it causes or allows the focus events of TextBox2 (the
next natural control in the tab sequence) to execute before finally
transferring control to the intended control (TextBox4).
Any thoughts or ideas????
Thanks!
Brian
We've been bitten by a change in behavior between .NET 1.0 and .NET 1.1.
Specifically: We determine in the Leave event what control to move to next.
E.g., We call textbox4.Focus() in the leave event of TextBox1.
In .NET 1.0 you would get 1 leave event when pressing the TAB key and **no
extra leave event** when calling .Focus() from within the already running
Leave event
What's different in .NET 1.1 is that if the control that I'm calling Focus
on (TextBox4) was not **already next** in the tab sequence from TextBox1, I
will get a SECOND, undesirable, extra Leave event on TextBox1. This has
broken our application and is causing a significant headache with our
migration to the new framework.
Is there a reason that this is happening, and is there a way for us to fix
this without undertaking a massive code change?
By the way, a similar reply to another thread provided by "Ying-Shen
Yu[MSFT]" suggested that putting focus() code inside of Focus events can
mess up the Windows message loop. I'm not sure if this example falls under
the same category. We've tried putting the call to Focus() on a call to
Control.Invoke (via the ThreadPool.QueueWorkItem) but this has two problems:
a) It defers execution of the Focus() event until after the Leave event has
finished executing
b) More seriously, it causes or allows the focus events of TextBox2 (the
next natural control in the tab sequence) to execute before finally
transferring control to the intended control (TextBox4).
Any thoughts or ideas????
Thanks!
Brian