mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:35:57 +02:00
LCL: TCustomForm.CloseQuery query all child forms
git-svn-id: trunk@25547 -
This commit is contained in:
parent
482773ba4b
commit
05e7dfaf66
@ -2013,19 +2013,30 @@ end;
|
|||||||
TCustomForm Method CloseQuery
|
TCustomForm Method CloseQuery
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomForm.CloseQuery: boolean;
|
function TCustomForm.CloseQuery: boolean;
|
||||||
var
|
|
||||||
i: Integer;
|
function Check(AControl: TWinControl): boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Child: TControl;
|
||||||
|
begin
|
||||||
|
for i:=0 to AControl.ControlCount-1 do begin
|
||||||
|
Child:=AControl.Controls[i];
|
||||||
|
if Child is TWinControl then begin
|
||||||
|
if Child is TCustomForm then begin
|
||||||
|
if not TCustomForm(Child).CloseQuery then exit(false);
|
||||||
|
end else begin
|
||||||
|
if not Check(TWinControl(Child)) then exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if FormStyle = fsMDIForm then
|
if FormStyle = fsMDIForm then
|
||||||
begin
|
begin
|
||||||
// Query children forms whether we can close
|
// Query children forms whether we can close
|
||||||
i:=0;
|
if not Check(Self) then exit;
|
||||||
while i<DockClientCount do begin
|
|
||||||
if (DockClients[i] is TCustomForm)
|
|
||||||
and not (TCustomForm(DockClients[i]).CloseQuery) then
|
|
||||||
exit(false);
|
|
||||||
inc(i);
|
|
||||||
end;
|
|
||||||
// TODO: mdi logic
|
// TODO: mdi logic
|
||||||
end;
|
end;
|
||||||
Result := True;
|
Result := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user