Jump to content

Recommended Posts

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

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

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

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

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

Hello,

One possible solution:

Uses ... , UniGUIJSUtils;

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

 

  • Like 1

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