realbasic-nug
[Top] [All Lists]

Re: Fastest append to text field?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Fastest append to text field?
From: Joe Strout <joe at inspiringapps dot com>
Date: Fri, 30 Nov 2007 11:43:56 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <D9A600C7-A072-4F7E-96A6-672D46EE7345 at xochi dot com>
On Nov 30, 2007, at 11:30 AM, Michael Diehr wrote:

> If you have text field which serves as a log, what's the fastest way
> to append to it?
>
> either
>    editField.SelStart = editField.text.Len
>    editField.SelText = data + EndOfLine
>
> or
>    editField.text = editField.text + data + EndOfLine
>
> e.g is it faster to Insert using .SelText, or to just replace the
> whole .Text object?

No!  Instead, use EditField.AppendText.  That's what it's for; it  
will not only be faster, but also avoid screwing up the selection and  
scroll position.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>