I created a checkbox (I liked the “stock” one but wanted the ability to make larger). It works well except I would like to change the cursor. The component is just a regular button with a shape (check) that is either visible or not depending on the state. Changing the button cursor to hand works fine, but if I mouse over the check the cursor changes to whatever the shape cursor is set to. If I change the shape cursor to hand, then when the component is not enabled, for whatever reason, the button cursor changes like it should, but the shape remains the hand. How can I make the shape cursor inherit the cursor of the button, so it’s automatic?
It sounds like this is Perspective, so I’ll chime in.
If you make the desired changes to a Perspective Style, then you could apply that style to both of your components, and should see the same behavior for both of them.
You’ll want to experiment with modifying the Element States for the Style by pressing the “+” button while editing the style, and then selecting “hover”.
Thanks for the reply, but not quite what I’m after. A button automatically enables/disables if it’s part of a container, for example. So, if I set cursor to hand and the button is disabled, the cursor is automatically changed. Since I don’t see the same behavior from a shape, I simply want to bind the shape cursor property to button cursor property. But, I don’t see how this is possible, or if it’s even the best solution.
I’m still confused - are you working with Perspective, or is this question about Vision?
If Perspective, then just add cursor
as a local-to-the-component style property, and you can bind it to whatever you want:
If Vision, then the cursor property is actually an integer representing one of the possible values - but you can’t bind it to another component directly, so you would have to make an expression listening to the ‘enabled’ property and returning the correct value as needed.
It’s vision. How do you listen to the enable property? For example, on a button it’s not exposed, at least I’m not seeing it. Sorry, just very little time to dig into this. If I have a button, how would the expression look?
Ugh, enabled is one of the ones you can’t directly bind to, for whatever reason. You could do it with a simple propertyChange script:
if event.propertyName == 'enabled':
if event.newValue:
event.source.getSibling("Shape").cursor = 4
else:
event.source.getSibling("Shape").cursor = 0
Thanks, always forget about using property change. Wish they would expose the enabled property though.