unit MCAD_MI1201_FrameDataSaveToFile; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TFrameDataSaveToFileDlgExt = class(TFrame) Panel1: TPanel; Edit1: TEdit; private { Private declarations } public { Public declarations } end; TDataSaveToFileDialog = class(TOpenDialog) private FFrame:TFrameDataSaveToFileDlgExt; procedure PreviewKeyPress(Sender: TObject; var Key: Char); protected procedure DoClose; override; procedure DoSelectionChange; override; procedure DoShow; override; published public constructor Create(AOwner: TComponent); override; destructor Destroy; override; function Execute: Boolean; override; end; implementation USES Consts; {$R *.DFM} {$R Mi1201Dlgs.RES} constructor TDataSaveToFileDialog.Create(AOwner: TComponent); begin inherited Create(AOwner); FFrame:=TFrameDataSaveToFileDlgExt.Create(Self); FFrame.Edit1.Parent:=FFrame.Panel1; end; destructor TDataSaveToFileDialog.Destroy; begin inherited Destroy; FFrame.Free; end; procedure TDataSaveToFileDialog.DoSelectionChange; var FullName: string; ValidPicture: Boolean; function ValidFile(const FileName: string): Boolean; begin Result := GetFileAttributes(PChar(FileName)) <> $FFFFFFFF; end; begin inherited DoSelectionChange; end; procedure TDataSaveToFileDialog.DoClose; begin inherited DoClose; Application.HideHint; end; procedure TDataSaveToFileDialog.DoShow; var FrameRect, StaticRect: TRect; begin { Set preview area to entire dialog } GetClientRect(Handle, FrameRect); StaticRect := GetStaticRect; { Move preview area to right of static area } FrameRect.Left := StaticRect.Left + (StaticRect.Right - StaticRect.Left); Inc(FrameRect.Top, 4); FFrame.Panel1.BoundsRect := FrameRect; FFrame.Panel1.ParentWindow := Handle; inherited DoShow; end; function TDataSaveToFileDialog.Execute; begin if NewStyleControls and not (ofOldStyleDialog in Options) then Template := 'MI1201DATASAVEDLGTEMPLATE' else Template := nil; Result := inherited Execute; end; procedure TDataSaveToFileDialog.PreviewKeyPress(Sender: TObject; var Key: Char); begin if Key = #27 then TForm(Sender).Close; end; end.