user729103
user729103

Reputation: 651

Delphi - How to programmatically make a modal dialog react like an event similar clicking on the background form

In our application, a modal dialog is shown that the user needs to confirm/close before other interaction is possible/allowed. This dialog is a self-implemented form, so can be adjusted to our needs.

An external event (in our case: a scan from a manual barcode scanner) provides input for the application. When the dialog is in front of the application, I would like to inform the user the scan/input is not processed. An idea is to simulate the behaviour that happens when clicking the form in the background of the modal dialog. By default, Windows then lets the dialog borders 'flash' and a sound is heard ('bonk' sound as described here: Delphi - How do you generate an event when a user clicks outside modal dialog?).

My question is:

Is it possible to programmatically simulate that behaviour, in order to let user know the dialog has to be closed first?

Additional question: is this proper UI handling or should the dialog itself display an additional info text (e.g. as a footer text) instead of just 'flash'. I like to avoid displaying another modal dialog on top of the first one; to me that not seem best practice as well.

Thank you for any feedback/solution.

Upvotes: 1

Views: 360

Answers (1)

David Heffernan
David Heffernan

Reputation: 612794

Use the FlashWindow or FlashWindowEx functions to achieve this.

Upvotes: 2

Related Questions