Link to home
Start Free TrialLog in
Avatar of hatecapletters
hatecapletters

asked on

insert/overwrite in Tmemo

I need to know how to set up a TMemo, so that i can either insert or overwrite the text, depending on what the user chooses. And if someone knows, how come borland haven't made that option available, considering that they use it in the IDE ?? ;-)
Avatar of ronvp
ronvp

Allthough not difficult There is no buildin way to do this with a standard memo control. So if you do want to use it, you would need to write a onkeydown event handler, and when a key is pressed, check if the user wants to overwrite and then delete the character immediately after the cursor. To do this proparly, you would also need to have a method to correctly handle a paste 0peration of multiple characters. i.e.: Delete from cursor position the number of characters that is on the clipboard before the paste operation is executed.

I do have a much easier method and that is to use a TRichEdit control which has all the functionality you want build in. You would not have to do anything else then to replace the Tmemo with a TRichEdit..
Avatar of hatecapletters

ASKER

i was thinking about that, but i'm using a colormemo, with elaborate colorcoding, and i'm not really reasy to re-write a trichedit to do that yet.
ASKER CERTIFIED SOLUTION
Avatar of ronvp
ronvp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
look s interessting, as soon as i get a bit of time, i'll look into it.

 
sorry for the delay :-)

i had to work a bit on it, but you sent me in the right direction, thanks :-)