I have written several successful WebAPI controls for various things, but this current project is driving me nuts. I need to track some data for display over the top of an image in the mouseover event of an HTML canvas. Getting the mouseover event to call into my library code works fine, but I cant seem to pass it any data. When new data is available for overlay I get an event in my Xojo class and a JSONItem that I want to just send to the browser to become a javascript data structure. There are no errors generated when I do this:
executeJavascript( XojoCustom.myApp.myControl.myControlID = + myJSONItem.toString)
of course filling in the proper controlID and such.
in my HTML setup I am returning basically this, wrapped in the upper level DIV of course:
<canvas id="<>_canvas"
onmousemove="XojoCustom.MyApp.myControl.drawMouse( this, XojoCustom.myApp.myControl.<>)>
again, replacing the controlid tags appropriately.
the drawMouse function in my library code is called but the second passed value is always undefined even when I know for certain that the first execute javascript has been called so there should be that javascript object available on the browser.
I feel like Im completely missing the point of the name space and that something very obvious is happening like its already adding the XojoCustom so Im adding it twice or something but Ill be darned if I can see it.
In the past Ive sent pre-made JSON data like that to the browser and accessed it through functions but Ive never tried to just send it and access it directly and not through a library function like that.
Any suggestions for sending a control its rather large and complicated data structure in JSON would be greatly appreciated!
Thank you.