From c2ab127031e98fb7b2ecc38efbdfc5935d208c7d Mon Sep 17 00:00:00 2001 From: alexs75 Date: Mon, 4 Mar 2013 20:21:52 +0000 Subject: [PATCH] RxFPC: Fixed a bug when the TRxCloseFormValidator on TFrame git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2694 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/rxcloseformvalidator.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/rx/rxcloseformvalidator.pas b/components/rx/rxcloseformvalidator.pas index 5636b4d0a..66a347063 100644 --- a/components/rx/rxcloseformvalidator.pas +++ b/components/rx/rxcloseformvalidator.pas @@ -305,11 +305,19 @@ end; function TRxCloseFormValidator.CheckCloseForm: boolean; var i:integer; + F:TComponent; begin + F:=Owner; + while Assigned(F) and not (F is TCustomForm) do + F:=F.Owner; + Result:=false; + + if not Assigned(F) then exit; + for i:=0 to FItems.Count-1 do begin - if FItems[i].Enabled and (not FItems[i].CheckClose(Owner as TCustomForm)) then + if FItems[i].Enabled and (not FItems[i].CheckClose(F as TCustomForm)) then begin FItems[i].SetFocus; Application.MessageBox(PChar(FItems[i].ErrorMessage), PChar(FErrorMsgCaption), MB_OK + MB_ICONERROR);