Textbox caret position?

Get help using Construct 2

Post » Thu Aug 08, 2013 5:32 am

simple question difficult answer.


Is there a way to know at which position the caret/cursor is?

B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Thu Aug 08, 2013 9:08 am

I'm not quite sure I understand.
Can you try to explain what you need it for?
B
9
S
2
G
2
Posts: 59
Reputation: 1,024

Post » Thu Aug 08, 2013 9:29 am

@Hoyer Bit hard to explain. I am using c2 for maths software.

I am using a text box to allow user to enter text. However, a virtual keyboard is also on screen that is requires to enter text that the student cannot enter by keyboard alone, e.g., exponents

i.e, I need to know where the caret is so that I can insert text.

I can post a capx tomorrow if it helps

B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Thu Aug 08, 2013 9:46 am

Here is a capx of the app as it currently - very early

https://www.dropbox.com/s/k544igpnaifrqez/InsertText_Caret.capx

Simply open it type in x+2

use left arrow to sit between x and the + and then click the n^2 virtual key, i want the exponent to appear where the user had their cursor but I don't know where their cursor was.
B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Fri Aug 09, 2013 3:59 am

bump.

The inability to expose the caret position is a real problem for me and this app. I would appreciate any help.

I am prepared to offer a bounty if someone can show me how to retrieve the caret position of an edit field. Either through a custom component or based on the official textbox.

I have been making a case for using C2 at work and I made a small demo proejct that everyone loved now working on a bigger project and it starting to look like C2 cannot handle the job :(

Help!
B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Sat Aug 10, 2013 1:53 am

We are looking at making a textbox variant and seeing if we can implement a BeforeText and AfterText expression, i.e., text before and after the caret. Out of my comfort zone
B
37
S
9
G
5
Posts: 437
Reputation: 6,094

Post » Sat Aug 10, 2013 3:26 am

Hooray! A break through

http://numberworks.com/nwonl/caretdemo/index.html

@Ashley, we have implemented a before and after text expression.

This works in firefox/chrome not in IE, would it be possible to have this functionality added to the official TextBox?

It would be very useful in long term for me and I hope others will also find a use for it.

https://www.dropbox.com/s/6eujr7t39njz8vn/TextBoxNWW.zip

I have included the Custom component code which is derived from textbox and I have included a capx that shows what I use it for.czar2013-08-10 03:58:50
B
37
S
9
G
5
Posts: 437
Reputation: 6,094


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 16 guests