Enter/Leave events firing unexpectedly. Help!

  • Thread starter Thread starter geneb
  • Start date Start date
G

geneb

I've got a number of tabs with text boxes on them. When you hit the
last textbox on a tab, it checks to see if the next tab is a valid
destination, then goes to it if so.

Unfortunately, when this happens, both the Enter _and_ Leave events of
the first textbox control are fired, causing all sorts of mayhem.

On a related note, I have another textbox that has it's Enter/Leave
events fired when other controls are changing focus programatically.
The controls changing focus are not text controls.

For example, if control A sets the focus to control B, and B sets the
focus to control D, and D sets to E, the Enter and Leave events of the
textbox will fire each time the focus changes. This happens even
though the textbox never has its .Focus() method called.

This is slowly driving me out of my mind.


Any ideas on how I can prevent this from ocurring? I'm using VS2K3.

Thanks!

g.
 
Here is further information for anyone that can assist.

This is the call stack showing what occurs from the point I press enter on
one control to the Leave event firing on the control I'm _going_ to.

The control sequence is txtbox -> dimAx -> dimAx -> txtbox.

The dimAx control automatically passes focus to the next control in line if
no input is allowed for it. I'm wondering if this control is causing all the
problems? It's a VB6 ActiveX control.

tnx!

g.




CCWeblink_OrderEntry.exe!CCWeblink_OrderEntry.frmOrderLine.txtVentInsideColor_Leave(Object
sender = {System.Windows.Forms.TextBox}, System.EventArgs e =
{System.EventArgs}) Line 8418 Basi
system.windows.forms.dll!System.Windows.Forms.Control.OnLeave(System.EventArgs e = {System.EventArgs}) + 0x5e bytes
system.windows.forms.dll!System.Windows.Forms.Control.NotifyLeave() + 0x15
bytes
system.windows.forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedControl() + 0x348 bytes
system.windows.forms.dll!System.Windows.Forms.ContainerControl.AssignActiveControlInternal(System.Windows.Forms.Control
value = {AxInsulateDim.AxINSDim}) + 0x26 bytes
system.windows.forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control
control = {AxInsulateDim.AxINSDim}, bool originator = true) + 0xf0 bytes
system.windows.forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control
control = {AxInsulateDim.AxINSDim}) + 0x13 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WmSetFocus(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x94 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x747 bytes
system.windows.forms.dll!System.Windows.Forms.AxHost.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x34e bytes
system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int
hWnd = 2689536, int msg = 7, int wparam = 1510746, int lparam = 0) + 0x3d
bytes
system.windows.forms.dll!System.Windows.Forms.Control.FocusInternal() + 0x4c
bytes
system.windows.forms.dll!System.Windows.Forms.Control.Focus() + 0x2d bytes
CCWeblink_OrderEntry.exe!CCWeblink_OrderEntry.frmOrderLine.txtVentOutsideType_KeyPress(Object
sender = {System.Windows.Forms.TextBox},
System.Windows.Forms.KeyPressEventArgs e =
{System.Windows.Forms.KeyPressEventArgs}) Line 9265 + 0x16 bytes Basi
system.windows.forms.dll!System.Windows.Forms.Control.OnKeyPress(System.Windows.Forms.KeyPressEventArgs e = {KeyChar=13 '
'}) + 0x5b bytes
system.windows.forms.dll!System.Windows.Forms.Control.ProcessKeyEventArgs(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x10a bytes
system.windows.forms.dll!System.Windows.Forms.Control.ProcessKeyMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x36 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WmKeyChar(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x3ae bytes
system.windows.forms.dll!System.Windows.Forms.TextBoxBase.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x67 bytes
system.windows.forms.dll!System.Windows.Forms.TextBox.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xc5 bytes
system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int
hWnd = 3082246, int msg = 258, int wparam = 13, int lparam = 1835009) + 0x3d
bytes
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(int dwComponentID = 8579107, int reason = 2, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = 2,
System.Windows.Forms.ApplicationContext context = <undefined value>) + 0x1f3
bytes
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = 2,
System.Windows.Forms.ApplicationContext context = <undefined value>) + 0x50
bytes
system.windows.forms.dll!System.Windows.Forms.Application.DoEvents() + 0x1a
bytes
CCWeblink_OrderEntry.exe!CCWeblink_OrderEntry.MainSystem.Main() Line 226 +
0x6 bytes Basic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top