Specifically, I have a button that opens a nonmodal child window. Something in the main window steals the focus away from the child window as it opens.
The fully general approach is to comment out parts of code until the problem goes away. I'm looking for faster methods.