52 lines
1.1 KiB
ObjectPascal
52 lines
1.1 KiB
ObjectPascal
unit uGUIUtils;
|
|
|
|
interface
|
|
|
|
uses
|
|
Controls;
|
|
|
|
function ControlIsModified(AControl : TWinControl) : Boolean;
|
|
procedure ResetModifiedControl(AControl : TWinControl);
|
|
|
|
implementation
|
|
|
|
uses
|
|
StdCtrls, uGUIBase, uCustomView;
|
|
|
|
function ControlIsModified(AControl : TWinControl) : Boolean;
|
|
var
|
|
i : integer;
|
|
begin
|
|
Result := False;
|
|
|
|
if AControl is TCustomEdit then
|
|
Result := Result OR (AControl as TCustomEdit).Modified
|
|
else
|
|
if not Result then
|
|
for i := 0 to AControl.ControlCount - 1 do
|
|
begin
|
|
if AControl.Controls[i] is TWinControl then
|
|
Result := ControlIsModified((AControl.Controls[i] as TWinControl));
|
|
|
|
if Result then
|
|
Exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure ResetModifiedControl(AControl : TWinControl);
|
|
var
|
|
i : integer;
|
|
begin
|
|
if AControl is TCustomEdit then
|
|
(AControl as TCustomEdit).Modified := False
|
|
else
|
|
for i := 0 to AControl.ControlCount - 1 do
|
|
begin
|
|
if AControl.Controls[i] is TWinControl then
|
|
ResetModifiedControl((AControl.Controls[i] as TWinControl));
|
|
end;
|
|
end;
|
|
|
|
end.
|