OnSetFocus beibg called when not expected

Started by Jim Short, September 07, 2012, 05:10:23 PM

Previous topic - Next topic

Jim Short

I have a tree control with nodes that, when touched, turn the tab on a tabstrip. Even though a textBox on the tab, is at the bottom of the z-order, an OnSetFocus event can fire. Only one of several nodes is doing this. I can't see anything in the code causing this. Can OpenDCL do it sometimes?
Jim Short

owenwengerd

Are you saying that after changing the current tab, the OnSetFocus fires on a textbox that does not get focus? Or it does get focus, but you don't think it should?
Owen Wengerd (Outside The Box) / ManuSoft

Jim Short

Ok... here is what my testing has revealed to me:

Position of a control on a form has no affect on who gets focus first.
The design time Z/Tab order does.
Labels higher in the Z/Tab order have no affect.
This would make sense because one would not normally be interested in having a label be a tab stop.

In my case, I was not paying close attention to who was at the top of Z/Tab order.
It would be best to place a check box or button first and any edit boxes below.
OnKillFocus, OnEditChanged, and OnSetFocus are common events for editboxes
that should only fire when the user arrives there on purpose.

After my tab was displayed I was immediately removing focus in code making the unwanted events hard figure.
Its all sorted now.
Jim Short