From c4969596c782d4662e5bdcd6b0bbda8b91b6c9ff Mon Sep 17 00:00:00 2001 From: alexs75 Date: Fri, 11 Jan 2013 14:19:14 +0000 Subject: [PATCH] fix rxcloseformvalidator git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2618 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/rxcloseformvalidator.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/rx/rxcloseformvalidator.pas b/components/rx/rxcloseformvalidator.pas index 493fb9d7d..b9ac5908d 100644 --- a/components/rx/rxcloseformvalidator.pas +++ b/components/rx/rxcloseformvalidator.pas @@ -56,7 +56,7 @@ type public constructor Create(ACollection: TCollection); override; destructor Destroy; override; - function CheckClose:boolean; + function CheckClose(AForm:TCustomForm):boolean; function ErrorMessage:string; procedure SetFocus; published @@ -228,7 +228,7 @@ begin inherited Destroy; end; -function TValidateItem.CheckClose: boolean; +function TValidateItem.CheckClose(AForm: TCustomForm): boolean; var P:TObject; PI1, PI2:PPropInfo; @@ -237,6 +237,10 @@ var begin Result:=true; if not Assigned(FControl) then exit; + if FControl = AForm.ActiveControl then + begin + AForm.SelectNext(FControl, true, true); + end; //Сначала проверим - вдруги это завязки на работу с БД PI1:=GetPropInfo(Control, 'DataSource'); PI2:=GetPropInfo(Control, 'DataField'); @@ -305,7 +309,7 @@ begin Result:=false; for i:=0 to FItems.Count-1 do begin - if FItems[i].Enabled and (not FItems[i].CheckClose) then + if FItems[i].Enabled and (not FItems[i].CheckClose(Owner as TCustomForm)) then begin FItems[i].SetFocus; Application.MessageBox(PChar(FItems[i].ErrorMessage), PChar(FErrorMsgCaption), MB_OK + MB_ICONERROR);