RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TApplication.NormalizeTopMosts Method

Makes forms that have been designated as topmost forms (their FormStyle is fsStayOnTop) behave as if they were not topmost forms.

Pascal
procedure NormalizeTopMosts;
C++
__fastcall NormalizeTopMosts();

Use NormalizeTopMosts to allow a message box or dialog box that is displayed using the Windows API functions (such as MessageBox and MessageDlg) directly, appear on top of a topmost form. Otherwise the topmost form remains on top, and may obscure the message box. 

Calling NormalizeTopMosts is not necessary when using functions to display message boxes. 

To return the forms designated as fsStayOnTop to be topmost again, call RestoreTopMosts.  

C++ Examples: 

 

/*
The following code causes "stay on top" forms to allow a 
MessageBox to appear on top. After the message box is 
closed, the topmost forms are restored so that they continue
to float to the top.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Application->NormalizeTopMosts();
#ifdef _DELPHI_STRING_UNICODE
Application->MessageBox(L"This should be on top.", L"Look", MB_OKCANCEL);
#else
Application->MessageBox("This should be on top.", "Look", MB_OKCANCEL);
#endif
Application->RestoreTopMosts();
}

 

Delphi Examples: 

{
The following code causes "stay on top" forms to allow a 
MessageBox to appear on top. After the message box is 
closed, the topmost forms are restored so that they continue
to float to the top.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  with Application do
  begin
    NormalizeTopMosts;
    MessageBox('This should be on top.', 'Look', MB_OK);    // [smbOK]
    RestoreTopMosts;
  end;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!