Autor Beitrag
AndreM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

Win2k, WinXP, Suse 10
D7 Ent
BeitragVerfasst: Mo 08.03.04 14:28 
Hallo,

ich habe ein kleines Problem. Und zwar bin ich derzeit dabei eine kleine MDI-Anwendung zu schreiben.
Mein Problem ist nun, wie ich von einem Chield aus auf ein Edit-Feld, welches auf einem andere Chield liegt, zugreifen kann. Über Form1.Edit1.Text geht es ja nicht, da ja theoretisch auch mehrere Chields mit dem Form1 erzeugt sein könnten.

Ich öffne die Chields per Buttonsklick über TForm1.Create(Self);.

Wenn ich jetzt zum Beispiel auf Edit1 auf diesem Forum über showmessage(Form1.Edit1.Text); zugreifen möchte, erhalte ich logischerweise eine Exception.

Kann mir hier vielleicht jemand einen Tipp geben, wie ich auf den Wert innerhalb eines Chields zugreifen kann, ohne diesen vorher in einer Variable zwischenzuspeichern?
tmc2004
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

zuviele
D7,D8
BeitragVerfasst: Mo 08.03.04 22:20 
{$R *.dfm}
vor diesen Text schreibst du

ausblenden Delphi-Quelltext
1:
uses deineunit;					


Öffne deine Formen so das sie jeweils nur einmal geöffnet werden oben das hier unter mdiform

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.CreateFormOnlyOnce(TFormName:TMyFormClass; var FormName);
var
   i : Integer;
   found : Boolean;
begin
   found := False;
   for i := 0 to MDIChildCount - 1 do
    if MDIChildren [i] is TFormName then
       begin
          found := True;
          MDIChildren [i].BringToFront;
          Break;
       end;
    if not found then
       begin
          Application.CreateForm(TFormName, FormName);
       end;
end;


oben vor private das einfügen :beer:

ausblenden Delphi-Quelltext
1:
procedure CreateFormOnlyOnce(TFormName:TMyFormClass; var FormName);					

:dance2:
jetzt unter einen button(vergesse nicht die unit einzubinden die du öffnen willst )

ausblenden Delphi-Quelltext
1:
CreateFormOnlyOnce(TForm1,form1);					


Hoffe das reicht dir. Hast etwas wenig informationen rein geschrieben.

gruß tmc :dance2: :dance2: :dance2: :autsch: :rofl:

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.

_________________
it's not a bug it's a feature
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 08.03.04 22:36 
@tmc2004: Ich hab in letzter Zeit bereits bei mehreren deiner Beiträge die Code- durch Delphi-Tags ersetzt. Bitte benutz in Zukunft die Delphi-Tags anstatt der Code-Tags, dadurch wird die Syntax des Codes hervorgehoben und der Code besser lesbar und du ersparst damit mir und den anderen Moderatoren Arbeit..! ;)

Dankeschön! :)

Gruß, Motzi

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!


Zuletzt bearbeitet von Motzi am Mo 08.03.04 22:59, insgesamt 1-mal bearbeitet
tmc2004
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140

zuviele
D7,D8
BeitragVerfasst: Mo 08.03.04 22:44 
Sorry ist mir gar nicht aufgefallen. Ich werd es in Zukunpft beachten.

Danke

tmc :party:

_________________
it's not a bug it's a feature