I’m having a bit of trouble with my text ctrl where I want to prepend and append tags (e.g. [bold]text[/bold]) to a selected range of characters/words.
So far I can somewhat come up with the way to do it but the result is different each time :
So basically you can see the mess im working with trying to get this working but my idea into it is …
get beginning and end point from cursor which I haven’t quite figured out as I just realize GetLastPosition is the end of the string not the selection
Add tags to beginnning and end of selected text using either Replace(…) or printing beginning of data - replacing selected text - then print the rest of the data.
So I guess my biggest problem is trying to figure out how to get both beginning cursor point and end point without chopping off the end of my strings when replacing selected text
Hi all,I'm having a bit of trouble with my text ctrl where I want to
prepend and append tags (e.g. [bold]text[/bold]) to a selected range of
characters/words.
So I guess my biggest problem is trying to figure out how to get both
beginning cursor point and end point without chopping off the end of my
strings when replacing selected text
You can use GetSelection() to find the position of the highlighted text. So
your function might look something like this (untested):
In your real code, you might need to add a test to determine if any text is
selected before doing the replace -- it depends on what you want to do in this
case.
Awesome this worked like a champ thanks a lot Brian
···
In your real code, you might need to add a test to determine if any text is
selected before doing the replace – it depends on what you want to do in this
case.