c++c++builderc++builder-6

How can I "unclick" a button in C++ Builder 6


I have a button in C++ Builder 6 that I need to activate (and stay activated). But when I don't need it anymore, I want to click again on that button, and it goes back to the UP state.

Thank you for your help.


Solution

  • if you're working with VCL controls I think you can use a TSpeedButton and implement the toggle logic with its TSpeedButton.Down property. It stays pressed while Down is true and unpressed when Down is false. Check this

    there are these properties for this:

    So for single button set AllowUp=true And GroupIndex to unique non zero number and for multiple buttons just set GroupIndex to the same unique non zero number for all buttons.

    Cheers!