How to mark clicked button?

Hello everyone,

I’m just getting started with servoy and have a first draft of my application running :D
I have form with 8 buttons to load various sub-forms into a formcontainer.
Now I wan’t to keep the highlight or mark the last clicked button, so that the user knows which sub-form he loaded, but can’t find a command to write into the onAction(event) that loads the sub-from.
Do you have any ideas?

Cheers
Alexander

Hi Alexander,

If you want to change the styling of a button you can do this by adding a style class to the element.
First of all you will need to create a css file (if you haven’t done this yet) and add a class for the highlighting, for example

.highlight {
   background-color: green;
}

Then in the onAction function you can add something like this:

   elements.myButton.addStyleClass('highlight')

Similar to ‘addStyleClass’ there’s also a removeStyleClass function to remove the class from an element.

Hope this helps

Thanks.

Works pertfect!