How to get Caret Position?

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to get Caret Position?

Postby john1598360627 » Fri Feb 02, 2024 2:12 am

CARET POSITION
Prior to NG Client, text fields had a 'Caret Position' value.

Previously, was using an algorithm that used the Caret Position to insert special text tags within a textfield by using this Caret Position value.

However, within NG Client, there seems to be no reference to the Caret Position.

There is a CSSPosition, but I'm pretty sure that's just the position of the element on the page and not related to the Caret Position.

HELP
How do I get the Caret Position of a text field, like the HTML Area? Does the CSS Position have something to do with it?
john1598360627
 
Posts: 191
Joined: Tue Aug 25, 2020 3:03 pm

Re: How to get Caret Position?

Postby mboegem » Fri Feb 02, 2024 2:01 pm

Hi,

in 2023.12 I have this function in the html area api
Code: Select all
replaceSelectedText(s)
Replaces the selected text; if no text has been selected, the replaced value will be inserted at the last cursor position.


According to the description that will do what you need.

Hope that helps
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1817
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: How to get Caret Position?

Postby john1598360627 » Sat Feb 03, 2024 2:44 am

mboegem wrote:Hi,

in 2023.12 I have this function in the html area api
Code: Select all
replaceSelectedText(s)
Replaces the selected text; if no text has been selected, the replaced value will be inserted at the last cursor position.


According to the description that will do what you need.

Hope that helps

That worked as you said, thank you!
john1598360627
 
Posts: 191
Joined: Tue Aug 25, 2020 3:03 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 2 guests