Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2000-04

TMemo & TListBox I/O errors?

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bogdan M.Maryniuck

Dear all.
Here is a real code from Delphi4, which works properly: �
procedure TForm1.Button1Click(Sender:
TObject);var� tt:textfile;� s:string;begin�
assignfile(tt,'c:\temp\test.txt'); //very big file� reset(tt);� while not eof(tt) do����
begin������
readln(tt,s);������
form1.Memo1.Lines.Add(s);������
form1.ListBox1.Items.Add(s);����
end;end;
�
On Lazarus this code is NOT working: tt:textfile -- unknown something;
form1.memo1.add(s) -- freezing the X-Server (on Linux) form1.ListBox1.Items.Add(s) -- is NOT working at all (or freezing the X-Server).
�
�
So howto... load a some text from an file to some shild like a simple NOTEPAD?
Thanx.

Reply by email

Hans-Joachim Ott
to Bogdan M.Maryniuck

Hi,

the problem with TMemo is that the text widget in gtk does not have a function to insert or add a line or get information on a specific line (or maybe I'm missing something?). So if a line is inserted, the current code reads the complete text into a StringList, inserts the line there and writes it back to the widget, and (for debugging) writes it also to stdout.
=> It helps if the program is run with >/dev/null
=> it helps a LOT if the text is read into a TStringList, and then put into the Memo by
TheMemo.Text := TheStringList.Text (don't use
TheMemo.Lines.Assign(TheStringList) !!)

Shouldn't we have different implementations for TMemoStrings for gtk, Windows etc., like we have it now for the listbox strings?

Kind regards, Hans

Reply by email

Michal Bukovjan
to Bogdan M.Maryniuck: Dear all. Here is a real code from Delphi4, which works properly: � procedure…

Yes, it definitely should have a similar implementation.

Michal Bukovjan

Hans-Joachim Ott wrote 23 lines
Hi, the problem with TMemo is that the text widget in gtk does not have a function to insert or add a line or get information on a specific line (or maybe I'm missing something?). So if a line is inserted, the current code reads the complete text into a StringList, inserts the line there and writes it back to the widget, and (for debugging) writes it also to stdout. => It helps if the program is run with >/dev/null => it helps a LOT if the text is read into a TStringList, and then put into the Memo by TheMemo.Text := TheStringList.Text (don't use TheMemo.Lines.Assign(TheStringList) !!) Shouldn't we have different implementations for TMemoStrings for gtk, Windows etc., like we have it now for the listbox strings? Kind regards, Hans _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email