Debug statement in a gotfocus event (OpenInsight 64-bit)
At 12 APR 2023 02:11:58PM Kayla Wachtel wrote:
Hello! We are in the middle of testing 10.2, and noticed some behavior that differs from what we’re used to in 9.4.
We’ve found if we have a debug statement in a gotfocus event (or any program called from inside a gotfocus event), we will get into an infinite loop where the debugger will continually pop back up after we F5 past it. It’s like the debugger pulls the focus from the control and then when we close the debugger, the control gets focus again, triggering the debug again. The only way I can get out of the debug-loop is by aborting out of the debug, which means I never actually get focus of the control. This behavior does not occur for us in 9.4.
Is this a bug? Or maybe something we can bypass somehow?
Thanks in advance,
Kayla
At 12 APR 2023 06:58PM Carl Pates wrote:
HI Kayla,
Using the debugger in a GOTFOCUS or LOSTFOCUS event is always difficult as the debugger always causes a focus switch which can trigger the event again, as Windows will return the focus to the previously active form. The usual way I debug this it to do something like send output to the system monitor so that the focus chain isn't disrupted, even in v9 and before.
Another possible workaround is to have the system monitor open - when you're in the debugger click on the System Monitor before the debugger runs again and under normal circumstances it should get the focus rather than the OI form so the GOTFOCUS won't get triggered.
Regards
At 13 APR 2023 11:44AM Kayla Wachtel wrote:
Thanks for the reply. It was a little jarring, since we have had many debug statements in gotfocus events in 9.4 and have never had this issue. :)
We will look into these other methods when we go live with our upgrade.