Any chance you can sort out this recurring Z-order issue, where modal dialogs popup beneath other windows? This problem has been in TOAD for about a decade.
A classic example, so I've F4'd a package call in another package's source. It brings up Describe Objects for that package source, I want to go to a line number to investigate an exception, Ctrl-G for Goto Line dialogue, but it's underneath the Describe Objects Window!
I know TOAD used to be written in Delphi, so you might want to read this.
If Delphi, this code below should fix your issue, if you set the modal dialog ParentForm to the form that spawned them :
function TMyForm.ShowModal(ParentForm: TCustomForm): Integer;
begin
PopupMode := pmAuto; // prevents recreation of window on next line
PopupParent := ParentForm;
Result := inherited ShowModal;
end;
We've done a lot of work to fix these over the years. And for me, CTRL+G comes up on top of the describe window. I've heard of cases where a user says that some window comes up behind, then they restart Toad, do the same thing, and the window comes up where it should. I'm not sure what leads to the wrong behavior after a while.
The technique we use is basically the same was what you suggested except we use pmExplicit instead of pmAuto:
procedure TSomeForm.ButtonClick(Sender: TObject);
var
frm: TSomeOtherForm;
begin
frm := TSomeOtherForm.Create(Self);
try
frm.PopupMode := pmExplicit;
frm.PopupParent := self;
if frm.ShowModal = mrOK then
begin
do something;
end;
finally
frm.free;
end;
end;
Thanks. For me it comes up correctly, but I see we aren't specifying popup parent there either, so maybe this one somehow gets out-of-whack after a while too. I'll fix.