Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change cursor on button

Explorer ,
Oct 12, 2016 Oct 12, 2016

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?

TOPICS
Advanced
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 13, 2016 Oct 13, 2016

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";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 13, 2016 Oct 13, 2016

I'm at a loss. I tried it many times but no matter what I set it to it stays as pointer???

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 13, 2016 Oct 13, 2016

Sorry, they are NOT used as buttons. I'll look into it when I get some time.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 13, 2016 Oct 13, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 14, 2016 Oct 14, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 14, 2016 Oct 14, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 16, 2016 Oct 16, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2016 Oct 17, 2016
LATEST

That is exactly what you need to do. I won't interfere with anything.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources