Board index » delphi » Stayontop form in DLL obscures modal form in parent app

Stayontop form in DLL obscures modal form in parent app

I am using a form in a DLL with a FormStyle of fsStayOnTop, but if the host
application has a reason to showmodal a dialog box, it is obscuring the DLL
form.

This is different to the situation where the form is part of the main
application.

I have tried passing the host applications TApplication and creating the DLL
form with it:

frmDLL := TfrmDLL.Create( HostApplication );  // doesn;t solve the problem

I have also tried passing the main form of the host application and setting
the DLL form's parent:

frmDLL.Parent := HostAppForm;  // now the dll form never appears

Any ideas?

Thanks,

Ian

 

Re:Stayontop form in DLL obscures modal form in parent app


Quote
On Wed, 12 Jun 2002 09:39:20 +0800, "Ian" <i...@kulin.com.au.spam>  wrote:
>I am using a form in a DLL with a FormStyle of fsStayOnTop, but if the host
>application has a reason to showmodal a dialog box, it is obscuring the DLL
>form.

Isn't this how it should be? If your dll form covered the modal dialog box,
you couldn't interact with the dialog (i.e. close it), and you couldn't
move the dll-hosted form to the side because the application has a modal
dialog open. I.e., you'd be locked out of the app.

(Which is quuite what happens when I open a *non* modal form from a dll. I
wish it would behave as your modal form does :)

.marek

--
/"\ ASCII Ribbon Campaign - Say NO to HTML in email
\ / Homepage, PGP Public Key: http://www.pdi.net/~eristic/
 X  No ads, no nags freeware: http://www.pdi.net/~eristic/free/
/ \

Re:Stayontop form in DLL obscures modal form in parent app


Quote
> Isn't this how it should be? If your dll form covered the modal dialog
box,
> you couldn't interact with the dialog (i.e. close it), and you couldn't
> move the dll-hosted form to the side because the application has a modal
> dialog open. I.e., you'd be locked out of the app.

Possibly but it is different from the interaction betwen a stayOnTop form
and a modal dialog inside the same executable.

In any case I asked for help too soom. I found the answer at
http://www.kaposnet.hu/books/tysdelphi4/ch19/ch19.htm#Heading19

It was to pass the host's application variable to the DLL and replace the
DLL's application variable with it and create the form passing the
application.mainform:

var
  DLLProc: TApplication;

....
if not assigned(DLLApp) then begin
  DLLApp := Application;
  Application := MainApplicationPassed;
end;
frmDLL : tfrmDLL.Create( Application.MainForm )
...

Then be sure to set the DLLs application variable back during cleanups.

Ian

Other Threads