You can loop a form's Controls property to see if the one you need is available:
procedure SetValues(AForm: TForm);
var i: Integer;
begin
if AForm = nil then
Exit;
// here you have to loop the form's Controls property and find the one you want to set.
for i := Low(AForm.Controls) to High(AForm.Controls) do begin
if AForm.Controls[i].Name = 'label1') then
(AForm.Controls[i] as TLabel).Color := clBlue;
if AForm.Controls[i].Name = 'edtBox') then
(AForm.Controls[i] as TEdit).Text := 'Blah';
end;
end;
I could not try a real example at this time. Am sure this will get you started though.
(Sounds like you should have a look at how to use a TFrame, instead of using this.)
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
It is caused by a strange way of building your code. Fixing that will always be akward, no matter what solution you choose. If they are so similar, a TFrame should have saved you a lot of trouble in the first place. It's hard to determine the best path from so little code.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
Great ;) Well, perhaps porting Blue (read copying) and functions to a new frame could still help. But that depends on your code, so it's just a guess... Good luck anyway.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874