Autor Beitrag
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: So 01.10.06 16:16 
Hi,
ich habe zwei Klassen:
1.TForm1
2.TBall1
Aus der Createprocedure von TForm1 habe ich vesucht eine public-Procedure von TBall1 zu "starten":
ausblenden Klassendeklaration
1:
2:
3:
4:
TBall1 = class
public    { Public-Deklarationen }
procedure MoveBall;
end;

ausblenden FormCreate-Anweisung
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.FormCreate(Sender: TObject);
begin
  DC:= GetDC(Handle);
  if not InitOpenGL then Application.Terminate;
  RC:= CreateRenderingContext( DC,
                               [opDoubleBuffered],
                               32,
                               24,
                               0,0,0,
                               0);
  ActivateRenderingContext(DC, RC);
  SetupGL;
  Init;
  InitTextures;
  MoveBall;//TBall1.MoveBall auch probiert;geht nicht
  Application.OnIdle := IdleHandler;
end;

Das bringt aber den Fehler:
Zitat:
[Fehler]pong.pas(64):Undefinierter Bezeichner: 'MoveBall'


was mache ich falsch :?: oder kann man nicht eine Methode aus einer anderen Klasse aufrufen :?:
Vielen Dank im Voraus
Leuchtturm :wave:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 01.10.06 16:20 
Wo erzeugst du eine Instant von TBall? Dz kannst die Methode nur übre ine Instanz aufrufen.

_________________
Markus Kinzler.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: So 01.10.06 16:28 
Achso
als was könnte man es dann als record deklarieren?

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 01.10.06 16:41 
user profile iconLeuchtturm hat folgendes geschrieben:
Achso
als was könnte man es dann als record deklarieren?

Ich verstehe hier nun den zusammenhang nicht. Eine Klasse ist ja nur eine Schablone (genauso wie ein Variablen-Typ) zum Anwenden bruacht man eine Instanz.

Du kannst einen Array der Klasse so definieren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
    Baelle: array of TBall;
...

Baelle.setLength( 1);
Baelle[0] := TBall.Create;
...

_________________
Markus Kinzler.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: So 01.10.06 16:48 
Danke :zustimm:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.