[Gambas-user] ListBox, how to auto-follow last added item.?

Jose J. Rodriguez joe1962 at ...626...
Fri Jan 26 12:00:01 CET 2007


On 1/26/07, timothy <timothy.marshal-nichols at ...247...> wrote:
>
> > -----Original Message-----
> > From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
> > bounces at lists.sourceforge.net] On Behalf Of Jose J. Rodriguez
> > Sent: Thursday, 25 January 2007 10:30 PM
> > To: mailing list for gambas users
> > Subject: [Gambas-user] ListBox, how to auto-follow last added item.?
> >
> > I can't figure out any way to use the ListBox as a data logger, that
> > is to "follow" the last added item and auto scrolling to keep it in
> > sight. Is it at all possible? If not, this would be a very useful
> > addition to it, IMHO. At least I use this kind of thing a lot in my
> > aplications.
> >
> > Tried Listbox.Index = Listbox.Count - 1, from something I found
> > searching the list, but no luck. Then went over the docs again,
> > searched on the Forums, etc, and tried a lot of possibles and even
> > some not so likely looking methods.... :(
> >
> > Regards,
> > Joe1962
> >
>
> Hello,
>
>         ListBoxLog.Index = ListBoxLog.Count - 1
>
> works for me.
>
> However if you are inside some long running event then the screen may
> not be updated. Try adding a WAIT after setting the index.
>
>         ListBoxLog.Add("New Item")
>         ListBoxLog.Index = ListBoxLog.Count - 1
>         WAIT
>
> So screen update events are processed.
>

The program is just waiting for data over a TCP socket. I am using a
simulator program on another computer to send the data at configurable
intervals. I don't think a receiving and displaying a line with about
60 characters every 5 seconds over a 100 Mbits LAN would need a wait
(P4 3.0 GHz laptop).  I'll try it anyway, though. I also forgot to add
that I am using Gambas2-1.9.47, with the qt component, in case this is
relevant.

Regards,
Joe1962




More information about the User mailing list