Tag Archives: dialogs

Dim Out the Main Form of an Application When a Modal Form (/Dialog) is Displayed

Dim Main Form From Dialog
Dialog windows you use to display critical information to the user are, in most cases, displayed modally. A modal window (form) is the one where the application can’t continue to run until the modal window is closed. Delphi’s ShowMessage, InputBox and MessageDlg, for example, display a modal form to the user waiting for some action. Your custom dialogs are displayed using the ShowModal method of a form.

Dimmer – a device for varying the brightness of light

To emphasize the importance of a modal form and the information it presents, you could gray out the main form of the application when the modal form is activated.
Continue reading

Time Out a Message Dialog – Auto Close a Dialog Window After Some Time / Seconds

messagedlgtimed Users do not read dialogs. They. Do. Not. Neither do we developers (admit it). Dialogs are scary things that pop to the user asking to make some kind of selection / decision. Users mostly simply click the little [x] button and hope no further questions would be raised. Regression: do you know what happens in your code if you display a [Yes|No] dialog and the user closes it by clicking on the [x] button?

Among various types of dialogs (and the information inside) you present to the user, be it a warning, error or information, one type actually requires no user input. Such dialogs are those displaying only the OK (or any single) button. It is questionable should you even have a dialog stating something to the user where the only possible user action is to click on the only button (+ the [x]) displayed by the dialog. Anyhow, I’m certain you have (at least I do) lots of those (…,mtInformation, [mbOk], …) scattered around your code.
Continue reading

Displaying Long Non-Breakable Text (File Path) In MessageDlg – Truncation/Ellipsis Issues

ttaskdialog-sample
Introduced way back in Delphi 2009 the TTaskDialog (defined in Dialogs.pas) implements task dialogs. Task dialogs first appeared in Windows Vista and are used in later Windows versions. In essence, a task dialog is similar to, while much more flexible and parameter-rich than the standard message dialog. You’ve surely seen such fancy dialogs in action: those containing message title and text (content), icons, push buttons, radio buttons, expandable footer area and more.

In Delphi we have several options (including ShowMessage, MessageDlg, Application.MessageBox and some more) when it comes to displaying some modal message to the user. I’m rarely using ShowMessage and Application.MessageBox as both are not as flexible as MessageDlg (actually ShowMessage internally calls MessageDlg).

MessageDlg: Bruce Banner or Hulk ?

Using MessageDlg can result in 2 different displays of the actual message dialog. What will get displayed (and more importantly how) to the user is dependent on several factors including the following: Windows version your application is running on, if the application was built including runtime themes and if Windows uses themes.
Continue reading