Autor Beitrag
M. Raab
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334
Erhaltene Danke: 1

WIN 7
Delphi XE
BeitragVerfasst: So 11.08.02 16:19 
Hallo NG,

ich habe ein Problem bei der Formularerstellung zur Laufzeit. Kurz hier das Programm:
ausblenden volle Höhe 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:
Procedure PROFILE_SCREEN;
  Var  lauf1     : integer;

   procedure loeschen;
     begin
       profil[lauf1].destroy;
       profil[lauf1]:=nil;
     end;

   procedure anlegen;
     begin
       Application.CreateForm(TForm,Profil[lauf1]);
       with profil[lauf1] do
         begin
           caption:='Profil '+inttostr(lauf1)+'.';
           Bild:=TImage.Create(Self);
           Bild.Parent:=Profil[lauf1];
           show;
         end;
     end;

begin

  setlength(profil,BLMAX+1);

  for lauf1:=1 to BLMAX do
    if profil[lauf1]=nil then
      begin
        anlegen;
      end else begin
        loeschen;
        anlegen;
      end;

end;

Es kommt die Fehlermeldung: undefinieter Bezeichner self. Ich kann es nicht compilieren. Nehme ich das mit dem Image raus, werden die Fenster sauber erzeugt.

Die Variablen PROFIL und BILD sind global definiert und das Unit ExtCtrls ist ingegriert.

Ziel ist es, einige Formblätter mit einem Image zu erzeugen. Die Abfrage mit NIL hat den Zweck, wenn der Benutzer das Fenster geschlossen hat und es wieder öffnen möchte, es nicht doppelt zu erzeugen. Nehme

Kann mir jemand die Fehlermeldung erklären und wie ich das Zeug wieder weg bekomme ?

Gruß und Danke


Markus :cry: :?: :?: :?:
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 11.08.02 17:17 
Hallo,

self wird nur unterstützt wenn sich die Methode innerhalb eines Objekts befindet. Wenn nicht dann gibt es diese "Variable" auch nicht. Macht ja auch keinen Sinn denn was soll Self zurück geben?

Statt self müsstest Du doch das Form als Parameter angeben, oder? Also:
ausblenden Quelltext
1:
Bild:=TImage.Create (Profil [lauf1]);					

Gruß
TINO
M. Raab Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334
Erhaltene Danke: 1

WIN 7
Delphi XE
BeitragVerfasst: Mo 12.08.02 14:41 
Hallo,

vielen Dank - ich werde es ausprobieren.

Gruß und Danke

Markus