{*******************************************************}
{                                                       }
{       Pascal Script Source File                       }
{       Run by RemObjects Pascal Script in CnWizards    }
{                                                       }
{       Generated by CnPack IDE Wizards                 }
{                                                       }
{*******************************************************}

program SetDesignTop;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

var
  AForm: TComponent;
begin
  // Please Add this Script to Script Library and Run it From Menu.

  AForm := CnOtaGetRootComponentFromEditor(CnOtaGetCurrentFormEditor);
  if (AForm <> nil) and (AForm is TForm) then
  begin
    Writeln('Design Form Found');
    
    // This is NOK because it only changes the FormStyle Property,
    { TForm(AForm).FormStyle := fsStayOnTop; }
    // which is not used in Designer.

    // Call StayOnTop in CnCommon, using SetWindowPos.
    StayOnTop(TForm(AForm).Handle, True);
  end;
end.

 