Re: Adding string to Memo



On Sat, 29 Oct 2005 12:11:04 -0700, Jamie
<jamie_5_not_valid_after_5_Please@xxxxxxxxxxx> wrote:

<snip>

>i could be wrong here but i thinkn selectstart is the
>API level indexer.

Yes, that is right

> if you use the "Text" property, it should give you
>the raw string like it is seen in the control.
> then using Insert(Memo1.Text, theStringToPutin,Memo1.SelectStart);
>memo1.Refresh and repaint may have to be used..

That would work, but it is making the machine (and Delphi) do a heck
of a lot of work
- the TMemo.Text property needs to be grabbed from the the real text
held within Windows, which boils down to a WM_GETTEXT, a string
creation, a string re-allocation as it is resized, then a WM_SETTEXT

It is possible that if one is going to do a lot of insertions in one
go (say a find an replace) that doing it outside the API would be
faster and clearer.


.