unit MCAD_MI1201_FormWarning; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TFormWarning = class(TForm) lMsgText: TLabel; pBottom: TPanel; bCancel: TButton; bOK: TButton; cbShowNextTime: TCheckBox; procedure bCancelClick(Sender: TObject); procedure bOKClick(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); private { Private declarations } function GetMsg:string; procedure SetMsg(aMsg:string); function GetShowNextTime:boolean; procedure SetShowNextTime(aState:boolean); public { Public declarations } property Msg:string read GetMsg write SetMsg; property ShowNextTime:boolean read GetShowNextTime write SetShowNextTime; end; var FormWarning: TFormWarning; function FormWarningCreate(Owner:TComponent):boolean; implementation {$R *.DFM} function FormWarningCreate(Owner:TComponent):boolean; begin Result:=Assigned(FormWarning); if not Result then begin try FormWarning:=TFormWarning.Create(Owner); Result:=Assigned(FormWarning); except Result:=FALSE; end; end; end; procedure TFormWarning.bCancelClick(Sender: TObject); begin ModalResult:=idCancel; end; procedure TFormWarning.bOKClick(Sender: TObject); begin ModalResult:=idOK; end; function TFormWarning.GetMsg:string; begin Result:=lMsgText.Caption; end; procedure TFormWarning.SetMsg(aMsg:string); begin lMsgText.Caption:=aMsg; end; procedure TFormWarning.FormKeyPress(Sender: TObject; var Key: Char); begin case Key of #13:bOKClick(Sender); #27:bCancelClick(Sender); end; end; function TFormWarning.GetShowNextTime:boolean; begin Result:=cbShowNextTime.Checked; end; procedure TFormWarning.SetShowNextTime(aState:boolean); begin cbShowNextTime.Checked:=aState; end; end.