Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

getBoundingClientRect() to screen coodinate

Post Reply
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

getBoundingClientRect() to screen coodinate

Post by coater »

If it is possible to translate a value of element.getBoundingClientRect() in JS to a coodinate in sendmessage() in delphi ? T hank you!
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: getBoundingClientRect() to screen coodinate

Post by salvadordf »

Read this thread :
https://www.briskbard.com/forum/viewtopic.php?p=9792#p9792

It has information for WebView4Delphi but it shows how to sent the element coordinates.

Use a JS extension to send the coordinates to Delphi :
https://github.com/salvadordf/CEF4Delphi/blob/373a19f8f512974d9c0c15b58fd5a5e009d3c24a/demos/Delphi_VCL/JavaScript/JSExtension/uJSExtension.pas#L85
coater
Posts: 187
Joined: Sat Sep 29, 2018 1:51 pm

Re: getBoundingClientRect() to screen coodinate

Post by coater »

sorry, I cannot find how to get correct coodinate in that web.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: getBoundingClientRect() to screen coodinate

Post by salvadordf »

The JSExtension demo uses a JavaScript extension with two methods : mouseover, sendresulttobrowser.

Copy that code and use "sendresulttobrowser" to send custom information from JavaScript to Delphi.
Post Reply