Board index » delphi » Newbie-Insert string at current cursor position..help

Newbie-Insert string at current cursor position..help

I'm at my wits end.

I've a text editor (memo), I want to be able to have predefined text
placed at the cursor position, no matter where the cursor is within the
memofield ie,

(Blank edit window),  event initiated and:-

PUTS THIS TEXT IN EDIT WINDOW  (another event initiated with the cursor
                                and T & I):-

PUTS THIS TEXT [EVENT HAPPENED HERE] IN EDIT WINDOW (another event
                                                   intiated with the  
                                            cursor between the S & T):-

PUTS {ANOTHER EVENT HAPPENED} THIS TEXT [EVENT HAPPENED HERE] IN EDIT
WINDOW

and so on.

I've tried ADD, INSERT but they don't do what I want them to do, and I
can't even work out how to put the predefined text string at the current
cursor position. I guess you could imagine it working like copy & paste
but without the user selecting text, as the text is predefined, ie,

procedure onclick ;
begin
memo1.PutInAtCurrentCursorPosition'[EVENT HAPPENED HERE]';
end;

(Yes I know it's wrong syntax but I don't know what the correct code
should be as I can't work out the procedure, hence me post).

Please help, hair is now coming out in fistfulls.....
TIA

Richard Coxon.
E-mail: Rich...@bungbear.demon.co.uk
   URL: http://www.zensys.co.uk/home/page/richard.coxon/

 

Re:Newbie-Insert string at current cursor position..help


Quote
Richard Coxon <Rich...@bungbear.demon.co.uk> wrote:
>I'm at my wits end.

Look up SelText, SelLength, SetSelTextBuf and associated properties
and functions. Basically you just assign your string to SelText and
Bingo!

--
John Nurick
j.nur...@dial.pipex.com

Other Threads