How to distinguish between button trigger click and actual click?

I’m currently working with TextButtons and I need a way to visually make a button appear as it has been clicked without triggering the action associated with the click. However, if you actually click the button, the button click should trigger the intended action. I tried using triggerClick(), but this makes the button think it has actually been clicked and carries out the action. I believe finding the solution to either of the following 2 things below would help me out. Also, if there is another approach I can take completely, I am definitely interested in learning about it.

  • I’m wondering if there’s something internally to distinguish between a button trigger and an actual click so that I can handle the two differently.

  • Another solution would be if there is a way to visually press the button down without any action associated with the click.

For a toggle button where you want to update the button state in response to a change in the data model, I’d normally use

Button::setToggleState (bool, NotificationType)

A call like this will make the button appear ‘on’ without sending any click callbacks:

button.setToggleState (true, dontSendNotification);