2 Replies Latest reply on Feb 12, 2013 3:31 PM by dsr1

    Inserting text at cursor position

    dsr1

      Title

      Inserting text at cursor position

      Post

           Hi,
           I am trying to provide tools for to quickly build up descriptive text using a portal displaying a list of phrases or clauses.

           Using the Paste script step simply appends that  text to the end of the target field's existing text. I can't get Paste to insert at the cursor position. I have considered manipulating the string but can't find a way to get the current cursor position.

           Any ideas?

        • 1. Re: Inserting text at cursor position
          philmodjunk

               Paste also requires a copy step and that can cause problems for your users by replacing their previously copied data with data copied from the database.

               That said, paste, if you don't specify the target field in the step should paste data at the insertion point marked by the cursor.

               But you can also do this with the script steps that start with Insert and not have to copy/paste.

               But clicking the portal row is causing your text field to "lose" the focus and thus the insertion point marked by the cursor.

               What you can do is use the OnObjectExit script trigger to capture the insertion point in a variable using the get ( SelectionStart ) function. (There is also a SelectionLength parameter for when text in the field is selected.

               You can then use the information captured this way with a set field or set field by Name (if you have more than one text field to edit from this portal), to insert text at the insertion point.

          • 2. Re: Inserting text at cursor position
            dsr1

                 Thanks Phil,

                 Worked perfectly.

                 A note for those who may refernce this topic in the future: the function for cursor postion is Get(ActiveSelectionStart).