Autor Beitrag
chrisx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mi 04.05.05 13:39 
Hi.

Ich hoffe, ich poste das thema in die richtige kategorie.
wenns niocht so ist, dann bitte verschieben.


aber nun zum thema:

ich hab auf meinem fomular ein memofeld.
und nun will ich, dass auf knopfdruck die anzahl der zeilenumbrüche, die der user durch die entertaste -oder wie auch immer- erzeugt wurden angegeben werden.


bsp:

zeile eins <umbruch>
zeile zwei <umbruch>
zeile drei <umbruch>
zeile vier


dann soll das programm die zahl 3 angeben.

und dann noch zu der zahl 1 dazuzählen.


ich hoffe ihr versteht, was ich meine.

gruß chris


Moderiert von user profile iconGausi: Topic aus Programmierwerkzeuge verschoben am Mi 04.05.2005 um 14:53
Asgar
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mi 04.05.05 13:46 
Also die Anzah erfährst du mit memo.lines.count
SvenAbeln
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 334
Erhaltene Danke: 3



BeitragVerfasst: Mi 04.05.05 13:46 
Hallo,

so bekommst du die Anzahl der Zeilen in deinem Memo:

ausblenden Delphi-Quelltext
1:
Zeilen := Memo.Lines.Count;					
chrisx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mi 04.05.05 13:53 
aha, vielen dank!

ist die variable Zeilen vom Typ Integer oder String?
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 04.05.05 13:54 
.Count gibt nen Integerwetr zurück.
Asgar
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Mi 04.05.05 13:55 
das ist Integer
chrisx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mi 04.05.05 13:59 
ok, danke!!

und kann mir noch jemand sagen, wie ich eine bestimmte zeile eines memofeldes ausgebe?
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Mi 04.05.05 14:02 
ausblenden Delphi-Quelltext
1:
Label1.caption:=memo1.lines.strings[1];					

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mi 04.05.05 14:04 
ausblenden Delphi-Quelltext
1:
Memo1.Lines.Strings[x];					


Moderiert von user profile iconGausi: Color- durch Highlight-Tags ersetzt.

_________________
Programmers never die, they just GOSUB without RETURN
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 04.05.05 14:04 
Wobei
Zitat:
1:

Label1.caption:=memo1.lines.strings[1];


Schon die zweite Zeile des Memos ausgibt, der fängt bei 0 an zu zählen :wink:
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mi 04.05.05 14:07 
also das mit den tags hat net so recht funktioniert, aber für x setzt du die gewünschte zeile ein. die erste Zeile hat den Index 0
Gruß

_________________
Programmers never die, they just GOSUB without RETURN
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: Mi 04.05.05 14:11 
[OT] Zu den Tags: Innerhalb der Code-Abschnitte funktionieren Tags nicht. Mit Ausnahme des Highlight-Tags. Habe die im oberen Beitrag geändert.
[/OT]

_________________
We are, we were and will not be.
chrisx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mi 04.05.05 14:21 
ok.

aber kann mir jetzt noch jemand sagen, wieso folgender code nicht funzt?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var
  COUNT: Integer = 0;



procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://chris.0ms.de');
Inc(COUNT, 0)     ;
end;




procedure TForm1.BitBtn1Click(Sender: TObject);
var  zeilen: integer;
begin

WebBrowser1.Navigate(memo1.lines.strings[COUNT]);

end;


normal soll auf knopfdruck jedes mal die zur nächsten zeile, die im memofeld steht der browser navigieren.

aber jedes mal wenn ich auf den knopf drücke, ruft er nur die erste zeile auf.
normal sollte er beim zweiten aufruf die zweite zeile aufrufen... usw.

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 04.05.05 14:31 
Die Var COUNT musst du immer um eines erhöhen.

COUNT := COUNT +1;

Und zwar bei jedem buttonklick
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Mi 04.05.05 14:34 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
var
  COUNT: Integer = 0;



procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://chris.0ms.de');

end;




procedure TForm1.BitBtn1Click(Sender: TObject);
var  zeilen: integer;
begin

WebBrowser1.Navigate(memo1.lines.strings[COUNT]);
Inc(COUNT, 1)     ;


end;

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
chrisx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mi 04.05.05 14:40 
aha, jetzt hab ich des mit dem count verstanden.

ich hatte gestern schonmal ein problem damit.

vielen dank!
jetzt funktioniert es!!!