Autor Beitrag
BrixxtoN
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

Win 7 64bit
Delphi 2010 Enterprise
BeitragVerfasst: Di 21.09.10 13:06 
Hallo,

ich habe drei Forms, aus zwei wird die dritte Form Modal geöffnet.

Form3 := TForm3.Create(self);
Form3.ShowModal;
Form3.Release;

Gibt es eine möglichkeit in der dritten Form bei FormCreate zu erfahren aus welcher Form die geöffnet wurde.

Oder muss ich da eine Variable an die dritte Form übergeben.
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Di 21.09.10 13:11 
Statt "Self" "Sender" eintragen, dann kannst du OnCreate den Sender auswerten, er zeigt dann auf das aufrufende Formular. Du kannst z.B. die Eigenschaft "Tag" setzen. Du musst "Sender" dann allerdings noch nach TComponent casten.

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
BrixxtoN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

Win 7 64bit
Delphi 2010 Enterprise
BeitragVerfasst: Di 21.09.10 13:37 
Habe das schon so probiert, aber das funktioniert nicht wie ich mir das gedacht habe.

Form1:
Form3 := TForm3.Create(Form1);
Form3.ShowModal;
Form3.Release;

Form3:
procedure TForm3.FormCreate(Sender: TObject);
begin
ShowMessage(Sender.UnitName);
end;

Bei ShowMessage wird noch immer der UnitName von Form3 zurück gegeben.
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Di 21.09.10 13:46 
überlade doch einfach den Constructor der der Modalform und übergib einen eindeutigen Integerwert oder sowas.

_________________
mfg. Joel
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 21.09.10 13:57 
user profile iconBrixxtoN hat folgendes geschrieben Zum zitierten Posting springen:
Oder muss ich da eine Variable an die dritte Form übergeben.

Das dürfte die einfachste Möglichkeit sein. ;-)

_________________
We are, we were and will not be.
BrixxtoN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

Win 7 64bit
Delphi 2010 Enterprise
BeitragVerfasst: Di 21.09.10 14:01 
Das denke ich mir auch.

Ich dachte nur es würde vieleicht eine einfachere möglichkeit geben z.B. über Sender, aber das hat irgend wie nicht funktioniert.

Das reicht mir alls Antwort, allen Danke für die Hilfe.
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Di 21.09.10 14:15 
Habs grad mal ausprobiert, mit property will es unter Delphi 7 bei mir nicht funktionieren, warum auch immer, aber so geht es:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
type
  TForm2 = class(TForm)
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
    procedure ShowModalvar(v: String);
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure tForm2.ShowModalvar;
begin
  self.Caption := v;
  self.ShowModal;
end;


und

Form3 := TForm2.Create(self);
form3.ShowModalvar('blabla');
Form3.Release;

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 21.09.10 15:57 
Den Anzeigenden bekommst Du nicht aber den Owner ..
ausblenden Delphi-Quelltext
1:
  if Assigned(Owner) then Showmessage(Owner.Unitname);