Forum Discussion

Paktolus's avatar
Paktolus
Community Member
2 years ago

Enabling reclicking of buttons

I created 6 buttons with the following triggers:

1. Show layer [layer name] when the user clicks Button 1.

2. Hide layer [layer name] when the user clicks Button 1, If the state of Button 1 = Visited.

If the user reclicks on any of the buttons, I want it to show them the layer again. What trigger would I use? Or, do I need to create a variable for that?

Thanks in advance.

 

  • Higher L,

    You can easily do this, but first, here’s an explanation of why your triggers don’t work. The button starts in Normal state. The first thing that happens when you click it is that it changes to Visited state, then executes the triggers that are associated with it.

    So the first trigger shows the layer, but before it registers on the screen, the second trigger hides it because the button is equal Visited state.

    What you need is for the first trigger to be “Show layer X when user clicks Button IF Button is equal Selected state”. The second trigger is “Hide layer X IF Button state IS NOT EQUAL Selected. What makes this work is that repeated clicking of the Button toggles it between Normal and Selected, even if the two states are identical. Note that IS NOT EQUAL Normal will not work, because both Normal and Selected are normal states.