come posso far funzionare il mio codice? :) ho provato a formulare questa domanda ma dopo diversi tentativi falliti penso che voi individuerete il problema più velocemente guardando il codice che leggendo le mie "spiegazioni". grazie.cast TObject usando il suo ClassType?
setCtrlState([ memo1, edit1, button1], False);
_
procedure setCtrlState(objs: array of TObject; bState: boolean = True);
var
obj: TObject;
ct: TClass;
begin
for obj in objs do
begin
ct := obj.ClassType;
if (ct = TMemo) or (ct = TEdit) then
ct(obj).ReadOnly := not bState; // error here :(
if ct = TButton then
ct(obj).Enabled:= bState; // and here :(
end;
end;
questo è * esattamente * quello che stavo cercando. Grazie! –