Strange tab behaviour when madExcept dialog showing
Strange tab behaviour when madExcept dialog showing
We had a strange report about funny chevron characters turning up in our edit controls rather than tabbing to the next control but it only happened intermittently.
We eventually tracked it down to only happening when there is a madExcept exception dialog showing which hasn't been actioned yet i.e. continue, restart, close etc. not chosen.
I'd always assumed those madExcept dialogs were modal but they aren't which makes sense since they are running on a different thread and message loop.
If I click to move the keyboard focus back to one of our controls and press tab or shift tab, I get a chevron character (how we indicate tab in strings) rather than tabbing to the next or prior control.
If I close the madExcept dialog by selecting continue, pressing tab and shift tab now work again as normal.
We use our own edit controls rather than stock Delphi TEdits and I thought it might be something we are doing, so I built a simple project with a pair of TEdits and a button which generates an Access Violation.
When the madExcept dialog is showing and I press Tab, rather than moving between the edits, I get a windows beep. So again, the control is getting a TAB keypress it doesn't expect .
I wondered if the madExcept dialog was putting in place some kind of message filter and changing the handling of WM_GETDLGCODE messages but I can't see anything so I'm at a bit of a loss.
Any ideas where else to look in the madExcept dialog code to avoid this?
We eventually tracked it down to only happening when there is a madExcept exception dialog showing which hasn't been actioned yet i.e. continue, restart, close etc. not chosen.
I'd always assumed those madExcept dialogs were modal but they aren't which makes sense since they are running on a different thread and message loop.
If I click to move the keyboard focus back to one of our controls and press tab or shift tab, I get a chevron character (how we indicate tab in strings) rather than tabbing to the next or prior control.
If I close the madExcept dialog by selecting continue, pressing tab and shift tab now work again as normal.
We use our own edit controls rather than stock Delphi TEdits and I thought it might be something we are doing, so I built a simple project with a pair of TEdits and a button which generates an Access Violation.
When the madExcept dialog is showing and I press Tab, rather than moving between the edits, I get a windows beep. So again, the control is getting a TAB keypress it doesn't expect .
I wondered if the madExcept dialog was putting in place some kind of message filter and changing the handling of WM_GETDLGCODE messages but I can't see anything so I'm at a bit of a loss.
Any ideas where else to look in the madExcept dialog code to avoid this?
Re: Strange tab behaviour when madExcept dialog showing
Hmmmm... That chevron character and Windows beep thing sounds pretty weird. You don't have set "HandleMessagesInMainThread := false", have you?
Which Delphi version are we talking about?
Which Delphi version are we talking about?
Re: Strange tab behaviour when madExcept dialog showing
Sorry, for the slow reply. I wasn't notified of your reply which is probably my fault for not checking some button.
HandleMessagesInMainThread is True as that seems to be the default. It's Delphi 10.1 Berlin.
HandleMessagesInMainThread is True as that seems to be the default. It's Delphi 10.1 Berlin.
Re: Strange tab behaviour when madExcept dialog showing
Should be fixed in this build:
http://madshi.net/madCollectionUpdate.exe
Basically madExcept replaced the main thread message loop and didn't have special handling for key messages. So I've now copied the VCL key message special handling. Hopefully doing that doesn't break anything...
http://madshi.net/madCollectionUpdate.exe
Basically madExcept replaced the main thread message loop and didn't have special handling for key messages. So I've now copied the VCL key message special handling. Hopefully doing that doesn't break anything...
Re: Strange tab behaviour when madExcept dialog showing
Awesome. Did you do the change in madExcept 4.x or 5.x?
I haven't switched to 5.0 yet - it's on my todo list, but I could if needs be.
I haven't switched to 5.0 yet - it's on my todo list, but I could if needs be.
Re: Strange tab behaviour when madExcept dialog showing
madExcept 5, of course...
Re: Strange tab behaviour when madExcept dialog showing
Upgraded to 5.0 and my issue is indeed fixed. I'll let you know if any regressions emerge but I'm pretty optimistic looking at the nature of the change.
Thanks a lot for your prompt attention to this, as always, Matthias.
Thanks a lot for your prompt attention to this, as always, Matthias.
Re: Strange tab behaviour when madExcept dialog showing
Happy to hear that!