Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Aug : Puzzling Tform issue with Delphi 5
| Subject: | Puzzling Tform issue with Delphi 5 |
| Posted by: | "Guy Harel" () |
| Date: | 16 Aug 2006 15:12:31 |
This is near insane, but I since I can reproduce it a will..
I have an MDI application. One of the menus opens a form with
ShowModal(). The form has a "preview" button which once clicked calls a
print service DLL. The DLL shows a form with Show(). The form contains
a quickreport preview pane and a close button. The close button simply
calls the Tform close method.
The problem I have is after I close the preview form in the DLL with
the close button, my main application freeze, does not show the calling
modal form, and stays iconized on the taskbar. This DLL has been
working as is for years. The problem just happened recently after some
change in the DLL by another programmer.
Trying to trace the situation with the Delphi debugger, I opened the
DLL project, change the output directory to the binary of the main
program and set the run parameter to start the main program. The
problem is reproduced.
Still in the DLL projet, I add a ShowMessage() before the call to
TForm.Close, and hit the CTRL-F9 button, then F9. The problem goes away.
I keep the ShowMessage() in place but select "Project/Build/MyDLL.exe"
instead. The problem comes back!
What is the difference between CTRL-F9 and a full build ?
Then I tried to comment out all code in the DLL close button and the
FormClose event. If I rebuild the DLL and start the program again, now
the application does not freeze, the call modal form has the focus but
its close button does not close the form ?
Some additionnal info: the DLL and the main exe do not uses the run
time, the main program does not passes the application handle to the
DLL.
Here is the code I modify in the DLL:
Test 1: ------------------------------------------------------
procedure TCustPreview.bCloseClick(Sender: TObject);
begin
ShowMessage('2');
Close;
end;
procedure TCustPreview.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
//ROBERT : next time previewer is opened, it will be on page 1...
QRPreview1.PageNumber := 1;
QRPreview1.QRPrinter := Nil;
end;
Test 2: ------------------------------------------------------
procedure TCustPreview.bCloseClick(Sender: TObject);
begin
//ShowMessage('2');
Close;
end;
procedure TCustPreview.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
//ROBERT : next time previewer is opened, it will be on page 1...
//QRPreview1.PageNumber := 1;
//QRPreview1.QRPrinter := Nil;
end;