Page 1 of 1

Getting Cursor Coordinates of Highlighted Text

Posted: Wed Mar 15, 2017 5:37 am
by AMunsell
I'm working with a multi-line edit box in a reusable part that is a command handler for a framework.

The multi-line edit box allows users to input a large blob of text that is then pushed to a Word Document.

In order to allow users to circumvent having to use Word when they are finished, I would like to implement simple formatting tools inside my reusable part (bold, underline, italicize, page breaks, text color, etc). In order to get certain text formatting tools to work, I need to be able to track the start and end point of where text is highlighted. Currently, I can only get the end of where text is highlighted by using the CurrentLine and CharacterPosition methods.

Is there a way to determine the start position of where a user has highlighted inside of a multi-line edit box (memo box)?

Re: Getting Cursor Coordinates of Highlighted Text

Posted: Thu Apr 06, 2017 1:04 am
by VLNinja70
I got something like this working using a widget
that's stuffed inside of a web page
that's stuffed inside of the activeX Browser control
that's stuffed inside of a form.
(LANSA inception :shock: )

Using JS, you can easily accomplish this with ranges and selects.
http://stackoverflow.com/questions/1365 ... n-textarea

The only catch was I had to use my Web page to do the IO layer, which talked to a server module to bring whatever data I wanted to and from the widget. So the form just turned into a container at this point.

But yeah, I don't think there is a way you can do this with just the text area control because like you said, it can only detect where the cursor is currently at but not where I started highlighting.

Hopefully this helps a little bit,
Good luck! :P

Re: Getting Cursor Coordinates of Highlighted Text

Posted: Sat Apr 08, 2017 4:23 am
by AMunsell
VLNinja70 wrote:I got something like this working using a widget
that's stuffed inside of a web page
that's stuffed inside of the activeX Browser control
that's stuffed inside of a form.
(LANSA inception :shock: )

Using JS, you can easily accomplish this with ranges and selects.
http://stackoverflow.com/questions/1365 ... n-textarea

The only catch was I had to use my Web page to do the IO layer, which talked to a server module to bring whatever data I wanted to and from the widget. So the form just turned into a container at this point.

But yeah, I don't think there is a way you can do this with just the text area control because like you said, it can only detect where the cursor is currently at but not where I started highlighting.

Hopefully this helps a little bit,
Good luck! :P
That's exactly what I ended up doing haha. I made a WAM with a Javascript frontend that takes in a GET parameter to route the user to where they need to go. I then use Javascript in a proprietary editor to markup the users' text, then submit it via the WAM. All of this is done in the VA_WEBCTL ActiveX control in a reusable part.

As far as I know, and according to LANSA support, this is the only way to go about this as of now.