Board index » delphi » Delphi 1.0/Windows 95/Modal Dialog Boxes

Delphi 1.0/Windows 95/Modal Dialog Boxes

Is there a fix or workaround for Delphi 1.0 (16-bit) apps that have a
main window and then put up a modal dialog box in Windows 95?

The modal dialog box gets its OWN button on the taskbar (with no
icon) so there are now two taskbar buttons for the SAME app. The user
can SWITCH to the app's main window using its taskbar button. This is
very confusing as the main window is now on top of the modal dialog
box (i.e. the z-order is different, maybe totally obscuring the
dialog) and the user can click on the main window and it just beeps.

(The reason for all this, I suspect, is because in Delphi 1.0, the
main window is NOT really the main window of the application. The
application actually has a hidden "proper" main window).

I've noticed that Delphi 2.0 has corrected this problem, but I would
like a solution for Delphi 1.0.

Any ideas?

Thanks,

Mark_Radcli...@msn.com

 

Re:Delphi 1.0/Windows 95/Modal Dialog Boxes


On 30 Aug 96 02:38:50 -0700, Mark_Radcli...@msn.com (Mark Radcliffe)
wrote:

Quote
>Is there a fix or workaround for Delphi 1.0 (16-bit) apps that have a
>main window and then put up a modal dialog box in Windows 95?

The way I do it is to set the parent of the dialog box to be the main
form (or whatever form is appropriate).  Do this after creating the
dialog form, but before making it visible, e.g.,

Dialog := TMyDialog.Create(Application);
try
  SetWindowWord(Dialog.handle, Gww_GwndParent, MainForm.Handle);
  if Dialog.ShowModal = mrOK then
    ... whatever ...
finally
  Dialog.Free;
end;

Quote
>The modal dialog box gets its OWN button on the taskbar (with no
>icon) so there are now two taskbar buttons for the SAME app. The user
>can SWITCH to the app's main window using its taskbar button. This is
>very confusing as the main window is now on top of the modal dialog
>box (i.e. the z-order is different, maybe totally obscuring the
>dialog) and the user can click on the main window and it just beeps.

>(The reason for all this, I suspect, is because in Delphi 1.0, the
>main window is NOT really the main window of the application. The
>application actually has a hidden "proper" main window).

Another approach is to have D1 emulate D2: there is always a single
button on the taskbar, for the application. To do it that way, set the
Ws_Caption style in the Application's window.
--
Ray Lischner, Author of Secrets of Delphi 2 (Waite Group Press)
Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

Other Threads