[ reikonija @ 21.09.2011. 19:04 ] @
Zanima me kako da izlistam sve brojeve od npr. 1 do 100 ali ne ovako : 1, 2, 3, 4, 5, vec kao 1,2,3,4,5,6 u Memo komponenti , znam preko for petlje ali su jedan ispod drugog. To je sve... |
[ reikonija @ 21.09.2011. 19:04 ] @
[ salaczr @ 21.09.2011. 19:11 ] @
Kreriaj neki string u petlji
Code: nekistring := ''; for i := 1 to 100 do nekistring := nekistring + IntToStr(i); a zatim ga upisi u TMemo Code: nekimemo.lines.add(nekistring); [ reikonija @ 21.09.2011. 19:14 ] @
Hvala na odgovoru , nisam dugo raio u delphiju , zapao u Pythonu :)
Resio sam: procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin for i:=0 to 10 do memo1.Text:=memo1.text + inttostr(i)+','; end; end. Hvala puno , na odgovoru :) [ X Files @ 21.09.2011. 19:50 ] @
Možda ne bi bilo loše pročitati ovo:
http://objectmix.com/delphi/40...tter-solution.html#post1511678 Citat: > Memo1.Text := Memo1.Text + Temptext; > Memo1.SelStart := Length(Memo1.Text); That is very inefficient. You are copying the entire TMemo contents to a temporary String, then replacing the entire TMemo contents with a new string, then copying the entire contents back to another temporary String to query its length. The more content the TMemo has, the longer those operations will take, and the more memory they will consume. Use the SelText property instead when appending new text, and use the GetTextLen() method to retreive the current length, ie: Code: Memo1.SelStart := Memo1.GetTextLen; Memo1.SelLength := 0; Memo1.SelText := Temptext; Memo1.SelStart := Memo1.GetTextLen; SendMessage(Memo1.Handle, EM_SCROLLCARET, 0, 0); Gambit Copyright (C) 2001-2024 by www.elitesecurity.org. All rights reserved.
|