Autor Beitrag
jsbach
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 53

Win XP
D5 Ent
BeitragVerfasst: Sa 26.03.05 04:12 
Hallo, ich möchte das meine Form2 mit "poOwnerFormCenter" auf meiner Form1 angezeigt wird. Wie aber lege ich die Eigenschaft "Owner" für Form1 fest? Wo muss ich diese angeben?

MfG jsbach

_________________
Was du für den Gipfel hälst, ist nur eine Stufe. (Seneca)
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 04:25 
Wenn Form1 deine Hauptform ist, dann hat sie keinen "Owner".
jsbach Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 53

Win XP
D5 Ent
BeitragVerfasst: Sa 26.03.05 16:59 
Nein, Form1 ist nicht meine Hauptform, das ist ja das Problem. Die Namen habe ich willkürlich gewählt.

MfG jsbach
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 17:05 
@Luckie:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(Owner.ClassName);  // Form1 ist das Hauptfenster, mit Application als Owner!
end;
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 17:13 
@jsbach: Der Owner des Hauptformulares wird durch den Aufruf von CreateForm festgelegt. Das gilt auch für weitere Formulare, die in der Projektunit angelegt werden. Wird ein Formular später manuell erzeugt, dann wird der Owner über den Parameter des Konstructors aForm := TForm.Create(aOwner); festgelegt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1); // Hier wird das Hauptformular erzeugt, Ower = Application
  Application.Run;
end.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 17:28 
user profile iconwdbee hat folgendes geschrieben:
@Luckie:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(Owner.ClassName);  // Form1 ist das Hauptfenster, mit Application als Owner!
end;

Aber den Owner meint er wohl nicht. Bei einem Visuellen Objekt übernimmt der Owner das Speichermanagement, während das Parent das Zeichnen übernimmt.
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Sa 26.03.05 17:33 
@Luckie: Selbst das ist noch zu einfach ausgedrückt, wie du am Beispiel von AXMD's Positionierfehler siehst! Button: Owner = Form, Parent = Groupbox, aber Groupbox: Owner+Parent: Scrollbox und Scrollbox: Owner+Parent = Form -> Falsche Positionen!