Hola...
Según la ayuda.. la propiedad
Visible de un
TField solo sirve para indicar si este se muestra o no en un
data grid...
En tu código no necesitas del
TDataLink para saber si un campo está o no asociado a un control... Podrías intentar con lo siguiente:
Código Delphi
[-]
procedure HideFieldControls(AForm: TForm; AField: TField);
var
I: Integer;
PropInfo: PPropInfo;
FieldName: string;
begin
for I := 0 to Pred(AForm.ControlCount) do
begin
PropInfo := GetPropInfo(AForm.Controls[i].ClassInfo, 'DataField');
if Assigned(PropInfo) then
begin
FieldName := GetStrProp(AForm.Controls[i], PropInfo);
if (AField.FieldName = FieldName) and (AForm.Controls[i] is TWinControl) then
TWinControl(AForm.Controls[i].Hide
end
end
end;
Esto lo hice de memoria y sin probarlo, espero te sirva...
Saludos...