Jump to content

UniCanvas doesn't have TextOut function?


Recommended Posts

  • 4 years later...
UniSession.AddJS(unicanvas.JSName + '._cc_.fillText("'+text+'",'+left+','+top+');');

UnicodeString s = UnicodeString().sprintf(L"%s._cc_.fillText('%s',%d,%d);", unicanvas->JSName, text, left, top);

Of course, is better if you do some escaping of the text first, otherwise you will be open to injection

Link to comment
Share on other sites

  • 1 year later...
2 hours ago, Bluecollar said:

How can i change the text color with the fillText function ?


One possible solution:

Uses ... , UniGUIJSUtils;

procedure TMainForm.UniButton14Click(Sender: TObject);
  UniCanvas1.JSInterface.JSCode('var me='#1'._cc_; if (me) {me.fillStyle="'+ uniColor2Web(clGreen, 1) +'"; me.font="20px sans-serif"; me.fillText("test", 100, 100)};');


  • Like 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.

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...