Delphi MainFormOnTaskBar Modal Window Error

Hi

I am using Delphi 2007 and set the MainFormOnTaskBar property to true.

The problem I am facing is this.

If you open a child window from the main form, and then you open the message dialog from the newly opened child window. When you close the message dialog box and close the child window, the main form will be sent to the background of any other application that you have on the screen.

This happens on Windows Vista and Windows 7. Does anyone know why this is happening and how I can fix it?

+1
source share
3 answers

.

-, stdcall DoFindWindow Forms.pas, Andreas Hausladen. , (CloseAction = caHide) .

- - TCustomForm.CMShowingChanged, FindTopMostWindow, , TCustomForm.CMRelease.

(Edit: 4 )

procedure TCustomForm.CMRelease;
var
  NewActiveWindow: LongInt;
begin
  if Application.MainFormOnTaskbar then
  begin
    NewActiveWindow := 0;

    if (GetActiveWindow = Handle) and not IsIconic(Handle) then
    begin
      NewActiveWindow := FindTopMostWindow(Handle);
    end;

    if NewActiveWindow <> 0 then
    begin
      SetActiveWindow(NewActiveWindow);
    end;
  end;

  Free;
end;

, , , .

+2

, QC66892- , , -, Delphi 2009 . QC Andreas Hausladen, . VCL Fix Pack, .

+5

PopupMode PopupParent TForm . , PopupParent , PopupMode - pmAuto.

PopupParent Z- , .

The Delphi 2007 Help has documentation on these two properties, but you need to go through TForm to get to them. Use "TForm, Pop" as a search topic (without quotes, obviously) to get there. Documents confuse PopupParent a bit because it discusses the effect of PopupMode on the automatic assignment of PopupParent. However, a small number of experiments after reading the documents should pay off.

0
source

All Articles