Autor Beitrag
schermerbua
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 17:04 
Kann ich eine aufgabe z.b einen speichervorgang, öfter ausführen, ohne immer den code hinschreiben zu müssen, also dass ich die aufgabe irgendwo definiere und dann nur mehr ein wort schreiben muss oder so! geht das?


Moderiert von user profile iconGausi: Topic aus Sonstiges verschoben am Di 26.04.2005 um 18:16
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 26.04.05 17:15 
Klar kann man das. Ich empfehle hierzu ein Tutorial mit dem Thema 'Prozeduren und Funktionen'. Das ist genau das, was du brauchst.

_________________
We are, we were and will not be.
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Di 26.04.05 17:16 
user profile iconschermerbua hat folgendes geschrieben:
Kann ich eine aufgabe z.b einen speichervorgang, öfter ausführen, ohne immer den code hinschreiben zu müssen, also dass ich die aufgabe irgendwo definiere und dann nur mehr ein wort schreiben muss oder so! geht das?
Stichwort: Prozedurale Programmierung, oder was meinst Du? Oder meinst Du Templates? Oder Makros?

Sagte ich schonmal, dass ich klare Fragenstellungen für langweilig halte? :?!?:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 26.04.05 17:19 
user profile iconGausi hat folgendes geschrieben:
Ich empfehle hierzu ein Tutorial mit dem Thema 'Prozeduren und Funktionen'.
Ich hätte das was anzubieten :mrgreen:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 17:19 
nein, prozeduren war was ich suche.wo find ich so ein tutorial?
Diabele$
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 53



BeitragVerfasst: Di 26.04.05 17:33 
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 17:35 
so habs gefunden, aber jetzt hab ich ein Problem
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Procedure Speichern;
begin
tables:= namecheck+sexcheck+agecheck+owncheck;
  Memo1.lines.add('<body bgcolor="#'+textbkg+'">');
  Memo1.Lines.Add('</head>');
  if bkg='' then Memo1.Lines.Add('<body>')
....
...
...

und jetzt sagt er beim ausführen folgendes:
[Error] Unit1.pas(144): Undeclared identifier: 'Memo1'
[Error] Unit1.pas(144): Missing operator or semicolon
[Error] Unit1.pas(144): Undeclared identifier: 'textbkg'
[Error] Unit1.pas(145): Missing operator or semicolon
und davon noch ganz ganz viele.
was hab ich falsch gemacht? genau der gleiche source funktioniert im gleichen form perfekt ohne Fehler!

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Diabele$
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 53



BeitragVerfasst: Di 26.04.05 18:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Procedure {jetzt kommt's:} TForm1.Speichern;
begin
tables:= namecheck+sexcheck+agecheck+owncheck;
  Memo1.lines.add('<body bgcolor="#'+textbkg+'">');
  Memo1.Lines.Add('</head>');
  if bkg='' then Memo1.Lines.Add('<body>')
....
...
...


Also nich das TForm1. dazuschreiben
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 19:59 
also bei mir funzt das nicht! kann mir jemand ein beispiel einer funktionierenden procedure reinschreiben?wär nett!
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Di 26.04.05 20:30 
tztztztztz was ist denn heute los... :shock:

diese fehlermeldungen können genau 2 gründe haben:
1. bei den funktionen, die du aufgerufen hast, fehlen der name des formulars.
2. die komponenten die du versuchst anzusprechen (memo1) ist nicht auf dem formular das du verwendest oder die komponente heißt anders.

die oben genannte funktion funktioniert einwandfrei, wenn dein formular form1 und deine komponente memo1 heißt.
nur so im allgemeinen interessse: wie heißt denn dein formular und welche komponenten verwendest du darauf (bzw wie heißen diese)?

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 20:38 
ich machs jetzt so: ich mach ein komplett neues Form, das ich Form 1 nenne und gebe einen Button rein, den ich Button1 nenne. der Button soll dann eine vorher definierte przedur ausgeführt werden. der code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Test;
begin
ShowMessage('Hallo');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
test;
end;

Und ich bekomm: Undeclared identifier"test"

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Di 26.04.05 20:44 
user profile iconschermerbua hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Test;
begin
ShowMessage('Hallo');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
test;
end;

Und ich bekomm: Undeclared identifier"test"

Diese Prozedur (Test) musst Du natürlich auch in der entsprechenden Klassendeklaration im Private- oder Public-Bereich bekanntgeben.

Dringender und gutgemeinter Tipp: Besorge Dir Einsteigerliteratur!

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Di 26.04.05 20:46 
d.h ich soll test bei z.b public als Test:Procedure deklarieren?
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Di 26.04.05 21:03 
unter dem wort public schreibste
ausblenden Delphi-Quelltext
1:
  procedure test;					


so einfach :roll:

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Mi 27.04.05 13:25 
OK! soweit so gut, aber ich bekomm immernoch einen fehler wenn ich das Prog ausführen will:
ich rufs so auf:
ausblenden Quelltext
1:
 Tform1.speichern;					

und dann kommt: Unknown directive TForm1
sorry :?
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 27.04.05 16:36 
user profile iconschermerbua hat folgendes geschrieben:
OK! soweit so gut, aber ich bekomm immernoch einen fehler wenn ich das Prog ausführen will:
ich rufs so auf:
ausblenden Quelltext
1:
 Tform1.speichern;					

und dann kommt: Unknown directive TForm1
TForm1 ist ein Klasse. Von dieser Klasse musst Du erst einmal eine Instanz erstellen, mit der Du dann arbeiten kannst.
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Mi 27.04.05 16:53 
ich hab ja ein Form, das Form1 heißt!
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 27.04.05 17:04 
user profile iconschermerbua hat folgendes geschrieben:
ich hab ja ein Form, das Form1 heißt!
Ja, aber eben nunmal nicht TForm1.

TForm1 ist die Klasse, Form1 eine Instanzvariable.
schermerbua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 63

Win XP

BeitragVerfasst: Mi 27.04.05 17:18 
ok, und was muss ich tun damit ich Tform bekomm? ich mein Buttons und so funzen ja auch!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 27.04.05 17:21 
Hallo!

Ich möchte Dich bitten, Dir ein oder zwei Grundlagen-Tutorials durchzulesen. Das hat so einfach keinen Sinn, dass Du herumrätst, wo welcher Buchstabe hin muss und eigentlich gar nicht lernst, weshalb die Buchstaben dahin kommen, wo sie denn hin sollen.

Ein Tutorial habe ich ziemlich weit oben in diesem Thread verlinkt (4.Posting von oben), bei [url=www.dsdt.info]Delphi-Source - Der Delphi-Treff[/url] findest Du viele weitere.

Bitte, tue Dir selber einen Gefallen und lies Dir diese Tutorials zuerst durch. Es mag Dir jetzt vielleicht unnütz erscheinenen, aber Du wirst sehen, dass dann vieles klarer und einfacher wird.

Viele Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".