Friday, May 25th 2018, 1:10pm UTC+2

You are not logged in.

  • Login
  • Register



Date of registration: Oct 5th 2017

Posts: 30


Tuesday, December 5th 2017, 12:58pm

Button SKIN - change button colour upon button press.

Dear all

Having this quick question: how to toggle the background colour of a skinned button? Where shall I change the colour: in the WM_NOTIFICATION_RELEASED of the pertinent window callback or in the button skin callback itself?

Could you provide a different example than the WIDGET_ButtonRound, please?


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 587


Tuesday, December 5th 2017, 3:29pm


This depends pretty much on how want your buttons look like. If you just want the default style but with different colors you should use the functions BUTTON_GetSkinFlexProps() and BUTTON_SetSkinFlexProps(). Read the old properties and write back the new ones. Make sure to save the default ones if you want to reuse them.

I don't really like the default look, so in most cases I overwrite the skinning routine or the callback and draw the button on my own. I do this either with standard drawing functions or with a bitmap. In this case I manage the colors and also decide when to use them.

Attached is an example which shows both ways. Of course, the second button looks very nice but it is just for demonstration.

SEGGER - Schoenen has attached the following file: