How do I add the .doClick() method to a custom button?

Hi,

I’ve made a button in a template with 2 buttons. Each of the 2 buttons are made in another template with custom properties and scripting.

I want to give the new button a multi-state-button like function so when one button is clicked the othe one will be unclicked.

To do this I think the doClick() function would be handy, but I get an error saying that my component doesn’t have it.

Can I give the buttons the doClick() function somehow?

Thanks

Hi there,

I suggest a different approach.

Use two Toggle Button components and bind the “selected” property of each button to each other so that when one is selected the other is unselected.

The expression binding on the “selected” property of the first button looks like this:

!{Root Container.Toggle Button 1.selected}

The expression binding on the “selected” property of the second button looks like this:

!{Root Container.Toggle Button.selected}

Then add a propertyChange script on each button for when a button is clicked on. Here is an example of such a script:

if event.propertyName == "selected" and event.newValue: print "The button was pressed"Best,

Hi again,

Thank you for your fast reply.

It is a good suggestion, but the problem is that I want to use custom graphics - as in I am drawing rectangles and circles in a template.

It seems I can’t do that if I choose the standard toggle button component.

Thanks

Only real buttons have doclick events, however other components have mouse events (mouseClicked, mousePressed, etc.) as well as allow you to define custom methods for them that you can call. Maybe with making use of these events and methods you can accomplish what you’re trying to do.