I’m trying to insert text at the cursorposition of a plain textfield. Is there a way to find out the current numerical position of the cursor in the textfield (so afterwards I can put my new text together with “textleftofcursor” and “textrightofcursor”). I know about the uidoc.inserttext method, but that is not an option for me (no richtext)
Subject: RE: position of cursor in plaintext field
Since you have now revealed that your form is displayed in a dialog, I think we can determine that the problem has nothing to do with whether the field is rich text. The user must activate your code by clicking some control in the dialog. And since you have no action buttons in a dialog, when they click a control they are also exiting the field. Therefore, you no longer have a position in the field.
I suppose you could do something with the exiting event of the field, e.g. you could insert some text at that time that you could search for and replace in your button. But that’s a little dodgy, especially since you can exit the field without clicking the button.