Insert value at cursor position in form field

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Fanski
User
Posts: 33
Joined: Tue Apr 17, 2012 10:33 am

Insert value at cursor position in form field

Post by Fanski »

With JS

this.getField("FieldName").value = "test value"

i can set the value of a form field.
How can i get the cursor position of the field, to insert a text at the positopn of the cursor?

So, the vield Value is "test text"
the cursor is placed at the begin of the second word ("text")
i would like to insert the text "insert" at the cursor position.
the result should be "test insert text"

thanks
Peter
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17907
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Insert value at cursor position in form field

Post by Tracker Supp-Stefan »

Hi Peter,

You can obtain the mouse coordinates directly through the Vewer AX SDK:
https://help.pdf-xchange.com/DEV/de ... ions_mouse
However determining where exactly that is relative to the text inside a form field might be harder.

Regards,
Stefan
Fanski
User
Posts: 33
Joined: Tue Apr 17, 2012 10:33 am

Re: Insert value at cursor position in form field

Post by Fanski »

Hi Stefan,
Thank you for your answer.
Sorry, my description was not exactly.
I didn’t mean the mouse cursor, I mean the editor (text) cursor when the form field is selected.
Like in the screenshot (attached zip), you see the cursor between the two words (insert text).
I want to insert a text programmatically at the cursor position (between the two words)

Thanks
Peter
Attachments
insert test.zip
screen shot
(11.43 KiB) Downloaded 112 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17907
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Insert value at cursor position in form field

Post by Tracker Supp-Stefan »

Hi Peter,

I don't think you can obtain that particular information.
You can however obtain the current field value, and then update it to the new one that will include your word in the middle as well.

Regards,
Stefan
Fanski
User
Posts: 33
Joined: Tue Apr 17, 2012 10:33 am

Re: Insert value at cursor position in form field

Post by Fanski »

Hi Stefan,

What a pity that i can't get this information, but thank you for your efforts.

Regards
Peter
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17907
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Insert value at cursor position in form field

Post by Tracker Supp-Stefan »

Glad I could assist Peter!

Regards,
Stefan
Post Reply