Page 1 of 1

Change cursor to hand

Posted: Mon Dec 28, 2020 12:56 pm
by williamdesmet
Hi there,

I like to change the cursor to hand on some buttons.
Anybody knows how to do it in LC HTML5?

Greetings,

William

Re: Change cursor to hand

Posted: Mon Dec 28, 2020 5:27 pm
by richmond62

Code: Select all

on mouseEnter
   set the lockCursor to true
   set the cursor to 28
end mouseEnter 

on mouseLeave
   set the cursor to empty
   set the lockCursor to false
end mouseLeave
28 is the ID of the hand curser.

This is for the stack: whether this transfers to HTML5 I am not sure.

Re: Change cursor to hand

Posted: Mon Dec 28, 2020 5:56 pm
by williamdesmet
Hi Richmond,

Thanks but I already tried this off course and noticed it didn't work.
Maybe someone already has solved this so I asked here.

In HTML5 the output is on html5 canvas and then you can edit the css style within the canvas tag:

Code: Select all

<canvas style="border: 0px none;" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
But this way you edit it for the entire canvas and I want it for only some buttons.

Maybe there is some 'mouseenter' javascript that I can use and then do the same thing as in this lesson:
https://lessons.livecode.com/m/4071/l/ ... -files-i…


Did not find it yet!

Re: Change cursor to hand

Posted: Mon Dec 28, 2020 8:15 pm
by richmond62
Thanks but I already tried this off course and noticed it didn't work.
Maybe someone already has solved this so I asked here.
OK, OK: I'm going to be bitchy (not that that's anything new) and state
that if LiveCode's claim to be able to build HTML5 deliverable stacks is
to reach a decent fruition the code I suggested should automatically be converted 'transparently' into HTML5
without any need for any further tinkering.

Personally I feel the the HTML5 part of LiveCode is far from mature, in fact so far
from mature that I would not touch it with a ten foot pole yet.

Re: Change cursor to hand

Posted: Tue Dec 29, 2020 12:54 pm
by williamdesmet
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?