Autor Beitrag
elduchte
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 199

Win 2000, Win XP
Delphi 7
BeitragVerfasst: Di 16.05.06 16:33 
Hallo,

ich versteh die Welt nicht mehr...

Ich habe in der Unit der Form1 eine Prozedur geschrieben, die ich in der Unit2 der Form2 aufrufen will.

Aber es geht nicht, obwohl ich die Unit1 unter Uses eingetragen habe... Es ging doch sonst immer, oder verwechsel ich da was ???
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 16.05.06 16:35 
probiers damit
ausblenden Delphi-Quelltext
1:
2:
3:
{...}
   Form1.deinprocedur;
{...}


könnte funktionieren

mfg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
elduchte Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 199

Win 2000, Win XP
Delphi 7
BeitragVerfasst: Di 16.05.06 16:38 
das ist es ja, das mache ich so, funzt aber nicht...
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 16.05.06 16:39 
post mal den code bitte!!!

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
elduchte Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 199

Win 2000, Win XP
Delphi 7
BeitragVerfasst: Di 16.05.06 16:48 
ok, also das ist die Prozedur, die aufgerufen werden soll:

ausblenden 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:
procedure TFrm_Haupt.KarteZeichnen();
var
  aPoint : array of TPoint;
  i : integer;
  x : integer;
  y : integer;
begin
  SetLength(aPoint,2);
  for i := 1 to m do
  begin
    if Strassen[i].Typ < 2 then
    begin
      aPoint[0].x := round((knoten[Pfeil[i].Anfknoten].xpos) * m_FaktorX);
      aPoint[0].y := round((m_maxy- knoten[Pfeil[i].Anfknoten].ypos) * m_FaktorY);
      aPoint[1].x := round((Knoten[Pfeil[i].Endknoten].xpos) * m_FaktorX);
      aPoint[1].y := round((m_maxy-Knoten[Pfeil[i].Endknoten].ypos) * m_FaktorY);
      DrawStrasse(Frm_Eingabe.PB_Netz.Canvas,apoint);
    end;
  end;
  for i := 1 to n do
  begin
    if (Knoten[i].Groesse<3) then
    begin
      x := round((Knoten[i].xpos-m_minx)*m_faktorX);
      y := round((m_maxy-Knoten[i].ypos)*m_faktorY);
      DrawOrt(Frm_Eingabe.PB_Netz.Canvas, Knoten[i].Name, 6-Knoten[i].Groesse,x,y);
    end;
  end;
end;


Auf Form2 würde ich sie so aufrufen:
ausblenden Delphi-Quelltext
1:
Frm_Haupt.KarteZeichnen();					


Die Fehlermeldung lautet: Undefinierter Bezeichner
elduchte Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 199

Win 2000, Win XP
Delphi 7
BeitragVerfasst: Di 16.05.06 17:05 
Fehler gefunden:

war nicht unter "public" deklariert..... oh man....

Danke trotzdem.
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: Di 16.05.06 17:06 
Da du nicht nur eingleisig darauf zugreifst musst du die beiden Units sich gegenseitig bekannt machen.

in unit 1 :
ausblenden Delphi-Quelltext
1:
2:
3:
implementation

uses Unit2;

In Unit 2 :
ausblenden Delphi-Quelltext
1:
2:
3:
implementation

uses Unit1;


also bei D2005 geht das so, bei älteren Versionen muss man eventuell einmal vor dem Implementation einbinden und die andere Unit danach.
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Di 16.05.06 17:28 
Titel: @azubi_20
Hä,
er hat doch den fehler schon gefunden, und es lag nicht am "eingleisigen zugreifen".

Was heißt denn "nicht nur eingleisig zugreifen" er hat doch in Unit2 auf Unit1 zugegriffen. Für mich ist das eingleisig.

!! Außerdem wenn man beide Units miteinander "bekanntmacht", so wie du, dann heißt das "[Fataler Fehler] Unit1.pas(6): Überkreuzender Bezug zweier Units auf 'Unit1'"

oder irre ich mich
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Di 16.05.06 17:47 
Titel: Re: @azubi_20
user profile iconbokaj hat folgendes geschrieben:
!! Außerdem wenn man beide Units miteinander "bekanntmacht", so wie du, dann heißt das "[Fataler Fehler] Unit1.pas(6): Überkreuzender Bezug zweier Units auf 'Unit1'"

oder irre ich mich


Das glaube ich auch das du dich da irrst.

Du sollst ja nicht Unit1 in die Uses-Klausel der unit1 einbinden, sondern Unit1 in Unit2 und Unit2 in Unit1.

Beides ist möglich. Wenn man es so mach wie azubi_20 beschrieben hat, muss man die Prozedur nicht als public deklarieren so weit ich weiß

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 16.05.06 18:06 
Grad ausprobiert. auch wenn ich dachte, diesen Fehler gibts, es gibt ihn nicht. Bei Delphi7e tritt er nicht auf.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Mi 17.05.06 13:29 
hast recht,
ich hab die units schon in der interface eingebunden.