Autor Beitrag
hassedelphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WIN XP
D7 Enterprise
BeitragVerfasst: Mi 13.08.03 09:59 
hi

weiß jemand, wie ich unterbinden kann, dass der compiler in eigen von mir erstellten proceduren ausdrücke wie findcomponent (nur als beispiel) als undefinierter bezeichner meldet? 8)

_________________
you're not be able to help, that you're an human
Andreas_Sans
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76



BeitragVerfasst: Mi 13.08.03 10:15 
das Problem hatte ich auch. man muss das jeweilige Formblatt angeben auf dem man die Komponente sucht z.B.:
ausblenden Delphi-Quelltext
1:
tpanel(form1.FindComponent('panel'+IntToStr(i))).font.Color := clblue					
hassedelphi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WIN XP
D7 Enterprise
BeitragVerfasst: Mi 13.08.03 10:34 
thx aber nachdem ich das ändere kommt die nächste fehlermeldung, die vorher nicht vorhanden war:

[Fehler] Unit1.pas(64): Ungenügende Forward- oder External-Deklaration: 'TForm1.modeundruck'

_________________
you're not be able to help, that you're an human
Andreas_Sans
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76



BeitragVerfasst: Mi 13.08.03 11:27 
schreib mal die ersten 100 zeilen deines Programms hin
hassedelphi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WIN XP
D7 Enterprise
BeitragVerfasst: Mi 13.08.03 11:37 
ausblenden Delphi-Quelltext
1:
2:
3:
  procedure Button1Click(Sender: TObject);
  procedure modeundruck; // fehlerzeile!!!
    private

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure modeundruck;
var efeld,rfeld : Tpanel; e : integer;
begin
 if (mode = 1or (mode = 2then begin
  efeld.caption:=(floattostrf(Tm1,fffixed,999999999,5)+' °C');
  rfeld.Caption:=('/');
 end//ausgabe der werte (ergebnis entsprchend)

 if mode = 3 then begin
  efeld.caption:=(floattostrf(Tm1,fffixed,999999999,5)+' °C');
  rfeld.Caption:=(floattostrf(mr,fffixed,999999999,5)+' kg');
 end//ausgabe der werte (ergebnis entsprchend)

 for e := 1 to 8 do (form1.FindComponent('checkbox'+inttostr(e))as Tcheckbox).checked := false;
end//nach rechnem die checkboxen zurückstellen

_________________
you're not be able to help, that you're an human
Andreas_Sans
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76



BeitragVerfasst: Mi 13.08.03 12:12 
Ich würde die Procedure so schreiben :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure modeundruck( mode : integer; Tm1, mr : Real);; 
var  e : integer; 
begin 
 if (mode = 1or (mode = 2then begin 
  efeld.caption:=(floattostrf(Tm1,fffixed,999999999,5)+' °C'); 
  rfeld.Caption:=('/'); 
 end//ausgabe der werte (ergebnis entsprchend) 

 if mode = 3 then begin 
  efeld.caption:=(floattostrf(Tm1,fffixed,999999999,5)+' °C'); 
  rfeld.Caption:=(floattostrf(mr,fffixed,999999999,5)+' kg'); 
 end//ausgabe der werte (ergebnis entsprchend) 

 for e := 1 to 8 do (form1.FindComponent('checkbox'+inttostr(e))as Tcheckbox).checked := false; 
end//


man muss die Variablen, die man aus dem Programm übernehmen will, hinter den Procedurenamen in Klammern schreiben. Sollen die Variablenwerte verändert werden muss man noch ein Var davor setzten.
Ich glaube die Panele muss man nicht nochmal definieren, daher hab ich sie weggelassen.

Diese Zeile procedure modeundruck; // fehlerzeile!!!würde ich ganz weglassen. Wenn du die Procedur später aufrufen willst, geht das so :

ausblenden Delphi-Quelltext
1:
modeundruck(mode,Tm1,mr);					
Tryer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 226
Erhaltene Danke: 7



BeitragVerfasst: Mi 13.08.03 12:15 
es fehlt einfach nur das

procedure TForm1.modeundruck;

MfG,
Tryer
hassedelphi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WIN XP
D7 Enterprise
BeitragVerfasst: Mi 13.08.03 12:28 
habe Tform1. vorangesetzt, da kommt aber sowas: :cry:


---------------------------
Fehler
---------------------------
'=' erwartet, aber ';' gefunden.
---------------------------
OK
---------------------------

_________________
you're not be able to help, that you're an human
hassedelphi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 101

WIN XP
D7 Enterprise
BeitragVerfasst: Mi 13.08.03 12:29 
nein wartet es klappt!!!!!!!!!!

THX! :D :D :D :D :D :D :twisted:

_________________
you're not be able to help, that you're an human
Tryer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 226
Erhaltene Danke: 7



BeitragVerfasst: Mi 13.08.03 12:34 
Damit sowas nicht passiert und man sich die Arbeit noch vereinfacht kann man so vorgehen:

- man erstellt die Methoden-Deklaration im interface-Abschnitt
- dann entweder Rechtsklick -> "Klasse beim Cursor vervollständigen" oder Strg-Shift-C

Dadurch werden automatisch die Prozedur-Rümpfe für die Methode(n) erstellt, das funzt u.a. auch für Get/Set-Methoden von Properties, diese werden dann auch automatisch deklariert.


MfG,
Tryer