Autor Beitrag
Pepp3r
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Di 31.10.06 11:25 
Hallo^^

Hab na Frage. Und zwar hab ich ein Programm geschrieben, in dem ich etwas in edit1 schreibe und per Button diese zeilen in Memo1 übertrage.
Neben dem edit1 hab ich eine Checkbox1. Wenn diese "Checked := flase" ist, soll der text NICHT in das memo übertragen.

Hier mal die Prozedur vom Button:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var i,anzahl:integer;
begin
anzahl := 200;
for i := 0 to anzahl do
form2.memo1.lines.delete (i);
for i := 0 to anzahl do
form2.memo1.lines.delete (i);
  with form2.memo1 do
    begin
      Lines.add('<span style="font-size: 20px; line-height: normal">'+'<span style="color: red">'+form1.edit1.Text+'</span>'+'</span>');
    end;


hoffe ihr könnt mir helfen :)
Gruss
Pepp3r

Moderiert von user profile iconKlabautermann: Code- durch Delphi-Tags ersetzt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 31.10.06 12:24 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var i,anzahl:integer;
begin
  anzahl := 200;
  //warm zweimal die gleiche Schleife ?!?
  for i := 0 to anzahl do
  form2.memo1.lines.delete (i);
  for i := 0 to anzahl do
  form2.memo1.lines.delete (i);
        if Checkbox1.Checked = true then
            form2.memo1Lines.add('<span style="font-size: 20px; line-height: normal">'+'<span style="color: red">'+form1.edit1.Text+'</span>'+'</span>');

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Pepp3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Di 31.10.06 12:56 
ui, da hab ich was gepatzt, du hast recht, zwei mal ist unnötig^^
Aber das beantwortet leider net meine frage :(
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 31.10.06 13:17 
user profile iconPepp3r hat folgendes geschrieben:
Aber das beantwortet leider net meine frage :(

Schau dir doch die if-Abfrage an. :!:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 31.10.06 13:17 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
var i,anzahl:integer;
begin
anzahl := 200;
for i := 0 to anzahl do
form2.memo1.lines.delete (i);
  with form2.memo1 do
    begin
      IF Form1.CheckBox1.Checked = True THEN  {* <<<<<<<<<<<< Diese Zeile fehlt dir *}
      Form2.Memo1.Lines.add('<span style="font-size: 20px; line-height: normal">'+'<span style="color: red">'+form1.edit1.Text+'</span>'+'</span>');
    end;
.
.
.

Wie Marco D. es schon geschrieben hat.

Gruß
Bäär
Pepp3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Di 31.10.06 13:25 
aaaahhh ok, habs geblickt ^^ wie einfach doch die lösung manchmal sein kann... vielen dank euch beiden!
Danny W.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Mi 15.11.06 14:15 
Ist es richtig das du 200 Zeilen löschen willst? Ein memo kann man auch ganz leicht mit memo.clear; leeren ;)

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mi 15.11.06 14:20 
ausblenden Delphi-Quelltext
1:
memo.lines.clear					

is besser^^

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.