Also ich hab jetzt so den Ansatz:
in MainForm hab ich von DELPHIUEBESTZ-Project alle Forms in CreateForm drin und mach eine Stringlist.
Delphi-Quellcode:
procedure TFormFG.FormCreate(Sender: TObject);
begin
MyForms := TStringList.Create;
Application.CreateForm(TForm1, Form1); Myforms.items.add('Form1');
Application.CreateForm(TForm2, Form2); Myforms.items.add('Form2');
Application.CreateForm(TFrmBlatt, FrmBlatt); Myforms.items.add('FrmBlatt');
Application.CreateForm(TForm4, Form4); Myforms.items.add('Form4');
Application.CreateForm(TForm4TC, Form4TC); Myforms.items.add('Form4TC');
Application.CreateForm(TForm5TC, Form5TC); Myforms.items.add('Form5TC');
Application.CreateForm(TForm6, Form6); Myforms.items.add('Form6');
Application.CreateForm(TFormindi2, Formindi2); Myforms.items.add('Formindi2');
Application.CreateForm(TFormindi1, Formindi1); Myforms.items.add('Formindi1');
Application.CreateForm(TForm8, Form8); Myforms.items.add('Form8');
Application.CreateForm(TForm7, Form7); Myforms.items.add('Form7');
Application.CreateForm(TUSBErrorForm, USBErrorForm); Myforms.items.add('USBErrorForm');
Application.CreateForm(TForm9, Form9); Myforms.items.add('Form9');
Application.CreateForm(TForm10, Form10); Myforms.items.add('Form10');
Application.CreateForm(TMainForm, MainForm); Myforms.items.add('MainForm');
Application.CreateForm(TInfoForm, InfoForm); Myforms.items.add('InfoForm');
Application.CreateForm(TForm11, Form11); Myforms.items.add('Form11');
Application.CreateForm(TForm4, Form4); Myforms.items.add('Form4');
Application.CreateForm(TForm5, Form5); Myforms.items.add('Form5');
Application.CreateForm(TForm12, Form12); Myforms.items.add('Form12');
Application.CreateForm(TForm13, Form13); Myforms.items.add('Form13');
Application.CreateForm(TForm111, Form111); Myforms.items.add('Form111');
Application.CreateForm(TForm14, Form14); Myforms.items.add('Form14');
Application.CreateForm(TFormMergeMe, FormMergeMe); Myforms.items.add('FormMergeMe');
end;
und dann lass ich die loop durch:
Delphi-Quellcode:
procedure TFormFIND.Button3Click(Sender: TObject);
var
i: Integer;
mymergedfn: string;
begin
listboxend.Clear;
mymergedfn:=filenameconform(datetimetostr(now));
savedialog1.filename:=format('%sGREPFORM.pas',[mypath]);
if Savedialog1.execute then
begin
for i := 0 to myforms.Count-1 do
begin
GetComponentCaptions(TForm(myforms[i]),savedialog1.filename);
end;
end;
end;
Doch leider ist der Code von oben nicht ok. Siehe Bild anbei.
So wie ich das sehe und in
https://www.tek-tips.com/viewthread.cfm?qid=1025706 steht
muss man zuerst fragen ob die TComponent einen Caption hat. und dann zb TLabel(
com).Caption machen.
oder? WIe kann man das machen?
Oder hier: man muss mit try machen:
Delphi-Quellcode:
procedure bla(c: TComponent)
for i := 0 to c.ComponentsCount-1 do begin
bla(c.Components[i])
try
(c.Components[i] as TControl).Caption := str
except
end
end
end
DANKE