Autor Beitrag
GR-Thunderstorm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 206



BeitragVerfasst: Fr 09.06.06 10:50 
Ich weiß dass das ne eigentlich ziemlich komische Frage ist, aber wie kann ich eine Form umbenennen, ohne dass es zu Fehlern kommt?
(Damit meine ich nicht Form1.Caption oder irgendwas in der Art!)
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 09.06.06 10:55 
Willst du den Namen der Form ändern? Das geht nicht direkt. Warum brauchst du das?
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Fr 09.06.06 11:00 
wie wäre es mit TForm.Name ändern?

edit:
Form1 anklicken
Objektinspektor öffnen
in das Feld "Name" klicken
neuen Namen eingeben
Enter drücken

_________________
Delphi: XE - OS: Windows 7 Professional x64
GR-Thunderstorm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 206



BeitragVerfasst: Fr 09.06.06 11:05 
Ich brauche das weil ich in mein Project ein anderes einbinden will, nur leider gibt es da schon eine "Form1"...

Das mit From1.Name probier ich gleich mal. :)
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 09.06.06 11:11 
Ok, ich hab gedacht du willst die Form während der Laufzeit umbenennen.
Aber so... Darauf muss man erstmal kommen :oops:
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 09.06.06 11:28 
Also ich hab mal ein bischen rumprobiert und folgendes ist dabei rausgekommen :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
var NewFormName: TForm;
begin
//form1 umbenennen
form1.Name := 'NewFormName';
//Zuweisung an die Form
NewFormName := (TForm(Application.FindComponent('NewFormName')));

//Zugriff auf NewFormName
NewFormName.Caption := 'NewFormName';
Showmessage(NewFormName.Caption);   // zeigt 'NewFormName'

//Auch über den alten Namen kann zugegriffen werden
form1.Caption := 'Form1';
Showmessage(form1.Caption);       // zeigt 'Form1'
Showmessage(NewFormName.Caption); // zeigt 'Form1'
end;


Ob das einen Sinn hat, ist zweifelhaft, aber so kann man tatsächlich einer Form während der Laufzeit einen neuen Namen verpassen... :zwinker:
GR-Thunderstorm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 206



BeitragVerfasst: Fr 09.06.06 13:27 
Den Text "Name" hab ich wohl irgendwie immer übersehen im Objekt Inspektor...

Danke! :)