delphifiremonkey

How do I change the color of a button after pressing it?


I just want to change the color of a button after I press it in FMX?

Do I have to use "styles" to do this or....?


Solution

  • You can change the button.StyleLookup property to change the style (color).

    You need to add a new style to the Stylebook.

    1. Select 'Edit custom style ...' in the Right mouse button menu from a button.
    2. Change the Fill.Color property from the TRectangle items under the background:TRectangle
    3. Apply and Close Stylebook
    4. Clear button.stylelookup
    5. Change the button.stylelookup in your buttonclick to the new create style, when you didn't change the name its Button1Style1