Jump to content

UniHTMLMemo - insert text at cursor position


rhennink

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
  • 9 months later...
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

Link to comment
Share on other sites

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?

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...