« Reply #4 on: November 08, 2019, 03:42:56 pm »
Thank you for Help.
I've managed one.
function IsInArray(pcCmp: TComponent; aCtr: array of TComponent ): boolean;
var
I : Integer;
begin
Result := False;
for I := Low(aCtr) to High(aCtr) do
begin
if pcCmp = actr[I] then
begin
Result := True;
Break;
end;
end;
end;
function fStateMnger( poForm: TForm; aCtrls: array of TComponent; eSI: TDBStateInfos) : Boolean;
var
I: Integer;
wCnt: TComponent;
IsIn: Boolean;
begin
Result := False ;
for I := 0 to Pred(poForm.ComponentCount) do
begin
wCnt := poForm.Components[I];
IsIn := IsInArray( wCnt, aCtrls );
// edit
if (wCnt is TEdit) and ( not IsIn )
then
begin
if eSI = siBrowse then
(wCnt as TEdit).Enabled := False
else if eSI in [siInsert, siUpdate] then
(wCnt as TEdit).Enabled := true;
end;
// Combo
if (wCnt is TComboBox) and ( not IsIn )
then
begin
if eSI = siBrowse then
(wCnt as TComboBox).Enabled := False
else if eSI in [siInsert, siUpdate] then
(wCnt as TComboBox).Enabled := true;
end;
// Memo
if (wCnt is TMemo) and ( not IsIn )
then
begin
if eSI = siBrowse then
(wCnt as TMemo).Enabled := False
else if eSI in [siInsert, siUpdate] then
(wCnt as TMemo).Enabled := true;
end;
end;
Result := True ;
end;
« Last Edit: November 08, 2019, 03:47:43 pm by BSaidus »
Logged
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!