rhennink Posted March 28, 2016 Share Posted March 28, 2016 HI, We would like to insert a string (from a variable) at the current cursor-position of the UniHTMLMemo. How do we do that?? Richard Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 28, 2016 Share Posted March 28, 2016 Hi, Try: procedure TMainForm.UniButton1Click(Sender: TObject); var s: string; begin s := 'something'; UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor("'+ s +'")'); // or - UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor("'+ s +'" + " ")'); end; Best regards. 1 Quote Link to comment Share on other sites More sharing options...
rgreat Posted December 12, 2018 Share Posted December 12, 2018 UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor("'+ s +'")'); or UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor('+ StrToJS(s) +')'); ? 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 12, 2018 Share Posted December 12, 2018 Yes, Use this: UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor('+ StrToJS(s) +')'); Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted September 29, 2019 Share Posted September 29, 2019 On 12/12/2018 at 10:38 PM, Sherzod said: Yes, Use this: UniSession.AddJS(UniHTMLMemo1.JSName + '.insertAtCursor('+ StrToJS(s) +')'); Hi I know it is an old post but I have 2 questions 1- how to move the Cursor to the end of the document as I want to add to the end of the old text Or another way to add to the end; 2- StrToJS is giving error so iam using the other way ("'+ s +'") what do I add in the uses list to make it work? regards and thanks for help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2019 Share Posted September 29, 2019 Hi, 2 hours ago, M.Ammar said: 1- how to move the Cursor to the end of the document as I want to add to the end of the old text Or another way to add to the end; UniHTMLMemo1.Lines.Add('add to the end...'); ? 2 hours ago, M.Ammar said: 2- StrToJS is giving error so iam using the other way ("'+ s +'") what do I add in the uses list to make it work? Can you make a simple testcase or provide the code? 1 Quote Link to comment Share on other sites More sharing options...
Ronbral Posted September 29, 2019 Share Posted September 29, 2019 Add to your Uses list: Uses ExtPascalUtils; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.