Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 3 odgovora
  • 2.140 pregleda

Najnovija ↓

Rad sa TMemo komponentom 21.09.2011. u 20:04 · pre 183 meseca #1
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...
Re: Rad sa TMemo komponentom 21.09.2011. u 20:11 · pre 183 meseca #2
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);

Re: Rad sa TMemo komponentom 21.09.2011. u 20:14 · pre 183 meseca #3
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 :)
Re: Rad sa TMemo komponentom 21.09.2011. u 20:50 · pre 183 meseca #4
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

Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme