williamdesmet wrote: ↑Tue Dec 29, 2020 12:54 pm
I was surprised too that it didn't work out of the box but maybe it is coming?
The LC roadmap indicates that there are updates for HTML5 on the way.
WebAssembly and HiDPI scaling will make it a bit faster and look better.
The last 3 weeks I'm 'fighting' with HTM5 because I think there is a lot of potential in it.
Not enough though to buy a full license yet.
Maybe after the new update.
----
For now I'm struggling with this javascript because it needs an ID
Code: Select all
<script>
function myFunction() {
document.getElementById("demo").style.cursor = "pointer";
}
</script>
Can I use this?
Can I give a button an ID that is recognized by this javascript?
Oh sorry, I just now stumbled on this thread, four years later. You were very close to the solution with your JS snippet!
In case anyone is still looking for an answer for this ...
This works with 9.6.3 for the Emscripten Engine from LC Community 9.6.3 (I have no idea if it applies to LC 10 or 'Create Cloud' or whatever).
This sets the cursor for a cavas element of the web page, which is what the stack is rendered into (with the exception of web 'native layer' widgets which get their own 'canvas'). The cursor will be set for as long as the mouseLoc stays within the stack area (which seems like the way most environments set the cursor, per view region or window. Just pass it the name of an HTML5 / CSS cursor (that come with web browsers), the list of names is part of the handler:
Code: Select all
on setCSScursor pCursorName
if the processor is "js" then -- check that we're in a web browser context
if pCursorName is empty then
put "document.getElementById('canvas').style.cursor = "& quote & "none" & quote & ";" into js
do js as javascript
else
put "alias,all-scroll,auto,cell,context-menu,col-resize,copy,crosshair,default,e-resize,ew-resize,grab,grabbing,help,move,"&\
"n-resize,ne-resize,nesw-resize,ns-resize,nw-resize,nwse-resize,no-drop,none,not-allowed,pointer,progress,row-resize,"&\
"s-resize,se-resize,sw-resize,text,auto,vertical-text,w-resize,wait,zoom-in,zoom-out,initial" into tCSScursors
if pCursorName is among the items of tCSScursors then
put "document.getElementById('canvas').style.cursor = "& quote & pCursorName & quote & ";" into js
do js as javascript
end if
end if
end setCSScursor
Example usage:
setCSScursor "grabbing"
This could probably be refined, for instance to make sure it's being set for the correct desired 'Canvas', but typically there's only one Canvas element being used.