You've already forked lazarus-ccr
fix rxcloseformvalidator
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2618 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -56,7 +56,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(ACollection: TCollection); override;
|
constructor Create(ACollection: TCollection); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function CheckClose:boolean;
|
function CheckClose(AForm:TCustomForm):boolean;
|
||||||
function ErrorMessage:string;
|
function ErrorMessage:string;
|
||||||
procedure SetFocus;
|
procedure SetFocus;
|
||||||
published
|
published
|
||||||
@ -228,7 +228,7 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TValidateItem.CheckClose: boolean;
|
function TValidateItem.CheckClose(AForm: TCustomForm): boolean;
|
||||||
var
|
var
|
||||||
P:TObject;
|
P:TObject;
|
||||||
PI1, PI2:PPropInfo;
|
PI1, PI2:PPropInfo;
|
||||||
@ -237,6 +237,10 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
if not Assigned(FControl) then exit;
|
if not Assigned(FControl) then exit;
|
||||||
|
if FControl = AForm.ActiveControl then
|
||||||
|
begin
|
||||||
|
AForm.SelectNext(FControl, true, true);
|
||||||
|
end;
|
||||||
//Сначала проверим - вдруги это завязки на работу с БД
|
//Сначала проверим - вдруги это завязки на работу с БД
|
||||||
PI1:=GetPropInfo(Control, 'DataSource');
|
PI1:=GetPropInfo(Control, 'DataSource');
|
||||||
PI2:=GetPropInfo(Control, 'DataField');
|
PI2:=GetPropInfo(Control, 'DataField');
|
||||||
@ -305,7 +309,7 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
for i:=0 to FItems.Count-1 do
|
for i:=0 to FItems.Count-1 do
|
||||||
begin
|
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
|
begin
|
||||||
FItems[i].SetFocus;
|
FItems[i].SetFocus;
|
||||||
Application.MessageBox(PChar(FItems[i].ErrorMessage), PChar(FErrorMsgCaption), MB_OK + MB_ICONERROR);
|
Application.MessageBox(PChar(FItems[i].ErrorMessage), PChar(FErrorMsgCaption), MB_OK + MB_ICONERROR);
|
||||||
|
Reference in New Issue
Block a user