Autor Beitrag
Roadrunner25
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Do 03.05.07 09:39 
Hallo Zusammen!

Ich möchte vor meinem Programm gerne ein Startfenster erzeugen, in dem ich die Sprache für das Programm wählen kann.
Hierzu habe ich in meinem aktuellen Projekt ein neues Formular (Form2) hinzugefügt. Click man jetzt auf einen Button, soll Form1 starten und sich automatisch die Caption der einzelnen Labels, Buttons verändern, je nach Spracheinstellung.

Unter Projekt/Optionen/... habe ich Form2 als Hauptformular und Form1 als verfügbares Formular deklaiert. Beide Units werden über USES verbunden.

Im Onclick-Ereignis steht bei mir folgendes :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm2.Button1Click(Sender: TObject);
begin

TForm1.create(self);

Form1.Button1.Caption := 'Set Definition'; // 

end;


Allerdings verursacht die Caption-Zuweisung einen Fehler, TForm1.Create(self) funktioniert einwandfrei....

Weis jemand, wo der Fehler liegt?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Do 03.05.07 09:56 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm2.Button1Click(Sender: TObject);
begin

Form1 := TForm1.create(self);

Form1.Button1.Caption := 'Set Definition'; // 

end;

_________________
Ein Nutzer der Ecke ;-)
bbfan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Fr 04.05.07 08:32 
Versuchs mal hiermit:

ausblenden Delphi-Quelltext
1:
  Application.CreateForm(TForm1, Form1);					


Solltest du aber dann aus deiner .DPR Datei rausnehmen.

Ansonsten habe ich das immer so gemacht:

Form1 = Hauptformular

Im onShow Event von Form1 dann Form2 mit showmodal aufgerufen.