How to get correct coordinates in WebDialog for MouseUp or MouseDown events

Does anyone know how to workaround the Xojo bug with mouse coordinates? <https://xojo.com/issue/20217> (only 4 years old!)

I’m trying get the x,y click position of a webCanvas in a webDialog, but instead of returning the position relative to the webCanvas’ top left, I’m getting numbers that look like they are referencing the underlying webPage. Since I can’t get the top left position of the webDialog, I can’t even work out the click position using the offset.

I have tried displaying the webDialog various ways (sheet/palette/modal/embedwithin), but nothing changes the outcome. This problem is happening on the first webDialog displayed from a webPage (another thread suggested that the problem only happens when a wedDialog displays another webDialog).

Thanks for your help in advance.

Xojo 2015 r2.4

Palette dialog does provide accurate X and Y.

Otherwise, set the position of the dialog yourself, and retain that value in properties, so you can subtract.

Thanks. I have experimented a bit more based on your suggestions:

  1. If I create the webDialog (any appearance type), set its top and left position, then show it, the mousedown x/y positions are correct (although the palette dialog does add on the title bar distance).

  2. If I use the palette dialog and move or resize it using the mouse, the mousedown coordinates are then wrong.

The solution for my current problem is to use the modal dialog to prevent movement/resizing. I’ll see if I run into any further issues and report back. Thanks again.