[lazarus] Another one bug add: TMemo & TListBox I/Oerrors?

Shane Miller SMiller1 at stvgb.org
Wed Apr 26 10:58:40 EDT 2000


I was thinking maybe the EOF wasn't working so try this:  
Create a button with the onclick event doing a 

if not(eof(file)) then
  Begin
   readln 
   listbox.add
  end;


Click it until the eof
Does it crash?  Hang?  If so then the eof is a prob.  If not then some other issue exists.
Shane


>>> m_bukovjan at advisbbdo.cz 04/26/00 09:25AM >>>
Yes, it might be you need to add an Application.ProcessMessages.
However, it should not be that thw whole application just freezes.
Do you actually reach the end of the file (i.e. the bug may be in the Eof
function)?
If the file is really large, it may take some time to add all the lines to
a list box.
Also, be sure the sorting is off.
And finally, try to create a temporary TStringList and then assign to
lines. I think this should be substantially faster (not tested).

Do you use GTK, Qt or Win32?

Michal Bukovjan

"Bogdan M.Maryniuck" wrote:

> Ok, Marc.
> Here is detailed answer:
>
> begin
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
> end;
>
> Here is all Ok -- I see my line there.
>
> When I try to (just for fun):
> begin
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
> end;
>
> All RIGHT. And all OK.
>
> But:
> while not eof(sometextfile) do
> begin
>    readln(sometextfile,somestring);
>    listbox.items.add(somestring);
> end;
>
> It's freezing a system. Do I need to add:
> application.processmessages
> into the LOOP? Or what?.. Please help.
>
> ----- Original Message -----
> From: Marc Weustink <Marc.Weustink at cuperus.nl>
> To: <lazarus at miraclec.com>
> Sent: 26 rddlë? 2000 a. 5:47
> Subject: RE: [lazarus] Another one bug add: TMemo & TListBox I/O errors?
>
> > + From: Bogdan M.Maryniuck [mailto:mbm at diprintas.lt] 
> > +
> > + Yes, it's work. Question is HOW.
> > + For example:
> > +
> > + while not eof(sometextfile) do
> > +    begin
> > +       readln(sometextfile,someasciistring);
> > +       listbox.items.add(someasciistring);
> > +    end;
> > +
> > + ...hanging a system and _NOT_ load a lines into a listbox. :-(
> >
> > How many lines are you trying to add? Have you tried one ?
> >
> > Marc
> >
> >
> > _________________________________________________________________
> >      To unsubscribe: mail lazarus-request at miraclec.com with
> >                 "unsubscribe" as the Subject
> >     archives at http://www.miraclec.com/list_archives/lazarus 
>
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus 

_________________________________________________________________
     To unsubscribe: mail lazarus-request at miraclec.com with
                "unsubscribe" as the Subject
    archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list