How to use DrawableButton as a toggle button

Is it possible to make DrawableButton behaves like a toggle? By default it should show image A. When clicked, it shows image B. when clicked again it shows the image A again.

I configure my button as follow, but the imageDown image is only shown when I hold the mouse down.

button.setImages (imageUp.get(),
                              nullptr,
                              imageDown.get(),
                              imageUp.get(),
                              nullptr,
                              imageDown.get());

button.setClickingTogglesState (true);

ImageDown is indeed just for the moment you hold it down.
normalImage and normalImageOn are the two ones you are looking for.

See setImages()

3 Likes