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

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Sa 06.01.07 01:26 
Hallo,

ich habe folgendes Problem.
In der Unit UMain wurde eine Funktion eingegeben, die in UParser verarbeitet wird.
UParser wurde im Interfaceteil eingebunden und UMain wurde im Implementationteil eingebunden.

Die Funktion erhält die Publicvariable byFunktion (UMain).
Diese Variable soll in UParser benutzt werden.

Nun erhalte ich den fehler, dass ein Methodenbezeichner erwartet wird.

UMain:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
type
  TForm1 = class(TForm)
    ... 
  private
    { Private-Deklarationen }
  public
    byFunktion : String;
  end;

...

procedure TForm1.BBuseClick(Sender: TObject);
begin
  byFunktion := Efunktion.text;
end;


UParser:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TParser.Wert(wert:String);
  var
    laenge , i: integer;
begin
  laenge := length(TForm1.byFunktion);
  for i:=1 to laenge do
  begin
    byWert := TForm1.byFunktion[i];
    TParser.Aufspaltung;
  end;
end;


Wer kann mir helfen?

Danke im Voraus.

MfG rizor
Jetstream
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 222



BeitragVerfasst: Sa 06.01.07 01:43 
user profile iconrizor hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TParser.Wert(wert:String);
  var
    laenge , i: integer;
begin
  laenge := length(Form1.byFunktion);
  for i:=1 to laenge do
  begin
    byWert := Form1.byFunktion[i];
    Aufspaltung;
  end;
end;


Versuchs mal damit.

_________________
Die folgenden Klangbeispiele sind Ergänzungen zum methodischen Aufbau der Textbeilage und dürfen nicht losgelöst von dieser behandelt werden.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Sa 06.01.07 02:51 
Super, danke.
Es geht, aber wieso?
Jetstream
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 222



BeitragVerfasst: Sa 06.01.07 03:05 
Das eine ist die Klasse, das andere die Instanz.

"TForm1" ist die Klasse, quasi der "Bauplan". Die fertige Form heisst bei dir aber "Form1".
Nur die Instanz hat bei dir die Variable "byFunktion", die Klasse aber nicht.
Deshalb nicht "TForm1.byFunktion", sondern "Form1.byFunktion".

Außerdem mag es Delphi nicht, wenn du in einer Methodendefinition den Namen der Methode wiederholst.
Klingt komisch, is aber so.
Deshalb wird aus "TParser.Aufspaltung" ein simples "Aufspaltung", weil das ganze in "TParser.Wert..." aufrufst.

_________________
Die folgenden Klangbeispiele sind Ergänzungen zum methodischen Aufbau der Textbeilage und dürfen nicht losgelöst von dieser behandelt werden.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Sa 06.01.07 03:19 
Danke.
Delphi ist für mich verdammt unlogisch :)