How can I find out the position of the selected text in a Text Box?

There is the text box “txtBox” in my dialog “Dlg”. After selecting (by mouse) some part of the text in the “txtBox” I can get this part by
sPart = Dlg.GetControl(“txtBox”).GetSelectedText().
I need to know the position p of this part in the all text of TxtBox.
p = Instr(Dlg.GetControl(“txtBox”).GetModel.Text, sPart) doesn’t work because all text can contain sPart many times before and after selected part.
Thanks in advance.

Use getSelection instead of GetSelectedText. This method returns Selection structure.

1 Like

Great! Спасибо!

2 Likes

Good luck!