Autor Beitrag
rstaeker
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 94

WIN 2000
D6 Prof
BeitragVerfasst: Sa 17.04.04 17:38 
Hallo,

ich habe mal wieder eine Frage:
Wie kann ich alle vorhandenen MDI Childs in einer MDI Form auflisten? Ich benötige eigentlich nur die Captions der einzelnen Formulare.

PS: Die Suche hat mir die dazu nichts gebracht oder ich verwende die falschen Suchbegriffe

MfG Rene
Benedikt
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 17.04.04 17:51 
Hi,

MDIChildCount und MDIChildren müssten dir helfen.

Damit kannst du die MDI-Childs durchlaufen und z.B. die Captions abfragen.
Johannes Maier
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173

Win XP
D7 Prof
BeitragVerfasst: Sa 17.04.04 17:54 
Nur so als Idee:

Du könntest eine Methode schreiben, die in etwa so aussieht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
for i:=0 to ComponentCount-1 do begin
  if (Components[i] is TForm) and ((TForm)Components[i].FormStyle = fsMDIChild) then
    ListBox1.Items.Add((TForm)Components[i].Caption); //Wenn du es in eine Listbox schreiben willst ...
end;


So würde es bei einer beliebigen Komponente gehen, vll gibts da auch bessere Methoden bei MDIFormen ...

MfG
Johannes

_________________
MfG
Johannes ehem. jbmaier
aM0xACiLLiN
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Sa 17.04.04 19:41 
Ganz einfach:

ausblenden Delphi-Quelltext
1:
2:
for c:=0 to (MDIChildCount-1) do
Memo1.Lines.Add(MDIChildren[c].name+'('+MDIChildren[c].caption+')');


Das setzt voraus, dass c ein integer ist und der code in der Mainform-unit ausgeführt wird. Ansonsten entsprechend anpassen..