Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 10:38 
Hi,

ich habe eine Form erstellt und möchte dort Labels erstellen.
leider wird mir gesagt, dass es TLabel nicht gibt.
Der Debugger gibt aus: EClassNotFound

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
  var
    LExp : array of TLabel;
begin
  FNewMap := TForm.Create(nil);
  with FNewMap do
  begin
    parent := nil;
    width := 500;
    height := 400;
    text := 'Neue Map erstellen.';
    position := poScreenCenter;
    BorderStyle := bsDialog;
    color := clBlack;
    Font.Color := clWhite;
    Show;
  end;


Wieso, kennt er das nicht?

Danke.

cu
rizor
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: Do 27.09.07 10:43 
Hast du die Unit StdCtrls eingebunden? Denn dort ist laut meiner Hilfe die Klasse TLabel definiert.

Ansonsten: Wie erzeugst du denn die Labels? Der Code hier erstellt ja nur die Form...

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

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 10:45 
Naja.
Schon beim Start des Programms wird der Fehler aufgerufen.
Und StdCtrls ist in der Hauptform gespeichert.
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: Do 27.09.07 10:51 
Also das Programm compiliert und gibt beim Start diese Fehlermeldung? Ich glaube, da ist dann etwas mehr Code nötig, um den Fehler zu finden :gruebel:

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

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 10:55 
Das ist der gesamte Code:

ausblenden volle Höhe 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:
29:
30:
31:
32:
33:
34:
35:
36:
procedure TFGZMapEdit.FormCreate(Sender: TObject);
  var
    hnd : HWnd;
    Rect : TRect;
    TaskH : integer;
begin
  hnd := FindWindow('Shell_TrayWnd', nil);
  if hnd<>0 then
  begin
    GetWindowRect(hnd, Rect);
    TaskH := Rect.Bottom - Rect.Top;
  end;
  Width := Screen.Width;
  Height := Screen.Height - TaskH;
  IWorld.Width := Width;
  IWorld.Height := Height;
end;

procedure TFGZMapEdit.Neu1Click(Sender: TObject);
  var
    LExp : array of TLabel;
begin
  FNewMap := TForm.Create(nil);
  with FNewMap do
  begin
    parent := nil;
    width := 500;
    height := 400;
    text := 'Neue Map erstellen.';
    position := poScreenCenter;
    BorderStyle := bsDialog;
    color := clBlack;
    Font.Color := clWhite;
    Show;
  end;
end;


Ich bin eben mal mit dem Debugger jeden Schritt durchgegangen und der Fehler tritt bei der
Formerstellung auf.
Also wenn die Hauptform geschrieben wird.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 27.09.07 11:04 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TFGZMapEdit.Neu1Click(Sender: TObject);
  var
    LExp : array of TLabel;
begin
  FNewMap := TForm.Create(nil);
  with FNewMap do
  begin
    parent := nil;
    width := 500;
    height := 400;
    text := 'Neue Map erstellen.';
    position := poScreenCenter;
    BorderStyle := bsDialog;
    color := clBlack;
    Font.Color := clWhite;
    Show;
  end;
end;


Ist TForm wirklich korrekt?
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 11:10 
Das ist Global so deklariert:

ausblenden Delphi-Quelltext
1:
FNewMap: TForm;					
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 27.09.07 11:11 
Versuchs mal so:

ausblenden Delphi-Quelltext
1:
FNewMap := TForm.CreateNew (Application);					
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 11:13 
Den Fehler hat er immer noch.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 27.09.07 11:24 
Ich hab mal nachgeschaut.
Mit TButton funktioniert es.
Ich habe keine Ahnung wieso.

//Edit

Ich habe array of TLabel mal ausgeklammert und er bringt den Fehler trotzdem.

Jetzt funktioniert es.
Ich hatte auf der Mainform aus versehen ein Label gesetzt.
Und das hat den Fehler verursacht.