Strange tab behaviour when madExcept dialog showing

delphi package - automated exception handling
Post Reply
zunzster
Posts: 58
Joined: Wed Oct 29, 2008 3:43 am

Strange tab behaviour when madExcept dialog showing

Post by zunzster »

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?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Strange tab behaviour when madExcept dialog showing

Post by madshi »

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?
zunzster
Posts: 58
Joined: Wed Oct 29, 2008 3:43 am

Re: Strange tab behaviour when madExcept dialog showing

Post by zunzster »

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.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Strange tab behaviour when madExcept dialog showing

Post by madshi »

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...
zunzster
Posts: 58
Joined: Wed Oct 29, 2008 3:43 am

Re: Strange tab behaviour when madExcept dialog showing

Post by zunzster »

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.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Strange tab behaviour when madExcept dialog showing

Post by madshi »

madExcept 5, of course... :D
zunzster
Posts: 58
Joined: Wed Oct 29, 2008 3:43 am

Re: Strange tab behaviour when madExcept dialog showing

Post by zunzster »

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.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Strange tab behaviour when madExcept dialog showing

Post by madshi »

Happy to hear that!
Post Reply