How can I make a form that is not disabled if another form is shown modally?

I have a utility dialog box (non-modal and Stay-on-top) that should be available at all times when using the application (think of a dialog box that can be used for notes while working with the application) even if a modal dialog is displayed .

The rest of the application cannot be modified.

Is it possible? How can i do this?

+8
delphi vcl delphi-xe
source share
1 answer

When ShowModal is called, all existing top-level windows are disabled. This is how modality is designed to work. If you have a window with which interaction is reasonable, you just need to turn it on again.

For example, you can add this to your utility window:

 type TMyUtilityForm = class(TForm) protected procedure WMEnable(var Message: TWMEnable); message WM_ENABLE; end; .... procedure TMyUtilityForm.WMEnable(var Message: TWMEnable); begin if not Message.Enabled then EnableWindow(Handle, True); inherited; end; 

This ensures that your utility window is never disabled.

+15
source share

All Articles