Skip to main content
Participating Frequently
September 8, 2016
Answered

Button down state

  • September 8, 2016
  • 2 replies
  • 1363 views

Hi, When changing the button "down" state to show that it has been pressed, it does not remain in that state more than one second tops, almost like the rollover state. What's the point of having a down state if the button does not remain in the state? I end up creating an advanced action changing the button to a custom state, which is not very practical. What am I missing here?

This topic has been closed for replies.
Correct answer TLCMediaDesign

And this is where JavaScript is so useful. You only need to write one function and do everything you want. Including incrementing variables based on which item was clicked. You can even show a greyed out button if what you want to do is show the user what they clicked on already.

2 replies

TinkerTrainer
Known Participant
September 8, 2016

I've done that before, but not with state changes.  I created a second image of the button toggled down (new colors, fonts, etc.), and made sure it wasn't visible in the normal output.  Then I showed the image as part of an Advanced Action call. Pretty easy, really.

Participating Frequently
September 8, 2016

Yes, that's what I do all the time. But working with a question sheet with ten questions and four options each, it would be easier if the state would just change to down when pressed, and STAY DOWN, and then you could use the advanced actions to increment a variable, for score, let's say. Otherwise you have to create an advanced action for each one of the 40 buttons... Not very practical. Once pressing Enter (or whatever), students will see which button they pressed, and which one was the right answer (using the final advanced action to show right and wrong marks according to the variable incrementation the button triggered). You can use a next button for each question too, which would increment a variable allowing to create one advanced action with ten conditionals. But still, if the down state would just remain down, it would be great. Thanks anyway!!!

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
September 8, 2016

And this is where JavaScript is so useful. You only need to write one function and do everything you want. Including incrementing variables based on which item was clicked. You can even show a greyed out button if what you want to do is show the user what they clicked on already.

TLCMediaDesign
Inspiring
September 8, 2016

Do you mean that when holding the mouse down on the button, the state changes? It should stay down as long as the mouse is down and you are over the button.

Participating Frequently
September 8, 2016

That does happen, but I'd like it to change permanently, like any other custom state. I guess that's not possible.

Lilybiri
Legend
September 8, 2016

Add a fourth custom state 'Pressed' to the three InBuilt states, you can even use a duplicate of the Down state. Use the Success event of the button to launch a standard action (because you probably have already an action) where you add the command:

    Change State of Button to Pressed

What you are asking for is not common practice for buttons. But if you use a shared action, and label the fourth custom state for all buttons the same way, it is pretty easy to add that shared action to each button. Moreover if you are aiming only at HTML, using the CpExtra widget by InfoSemantics with its @ and # syntax will make it even easier.