Change cursor on button
Copy link to clipboard
Copied
I've seen the blog post by TLC Media Design on changing the cursor style but I'm unable to get it to work with a smart shape that's being used as a button.
Does anyone know how to change the cursor style over a button?
Copy link to clipboard
Copied
In the demo that is used with the blog, all of the cursor examples are smartshapes used as buttons. You can execute JavaScript:
document.getElementById("SmartShape_1").style.cursor="pointer";
Copy link to clipboard
Copied
I'm at a loss. I tried it many times but no matter what I set it to it stays as pointer???
Copy link to clipboard
Copied
Sorry, they are NOT used as buttons. I'll look into it when I get some time.
Copy link to clipboard
Copied
I think I worked out why it wasn't working!
If within Cp you have the button's checkbox Actions > Hand Cursor checked then (I'm just guessing here) Cp takes dynamic control of the cursor and so any custom JavaScript that overwrites the cursor style itself gets continually overwritten. If I uncheck the box then the button's cursor style can be changed by custom JavaScript.
Copy link to clipboard
Copied
I'm going to be updating the add-in code to fix this. There are multiple elements defining the button and a canvas element doesn't respond to mouse events. When you choose the cursor in Captivate there is code added to handle that. The cursor is responding to the element below the canvas element when you don't set the hand cursor in Captivate.
Copy link to clipboard
Copied
I modified the code and it now works if you use as a button with or without the "hand" cursor. I'll update the add-in and send out a message to download it again tonight or tomorrow.
Copy link to clipboard
Copied
And it could just be that I need to add "!important" to the JS setting the CSS. So instead of
document.getElementById("myElem").style.cursor = "cell";
I do
document.getElementById("myElem").setAttrribute("style", "cursor:cell !important");
Though I don't yet know if that will interfere with the element's existing style declarations. More testing will tell.
Copy link to clipboard
Copied
That is exactly what you need to do. I won't interfere with anything.

