Saturday, December 16th 2017, 7:35pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mjanas10

Beginner

Date of registration: Oct 5th 2017

Posts: 30

1

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?

Thanks

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 443

2

Tuesday, December 5th 2017, 3:29pm

Hi,

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.

Regards
Sven
SEGGER - Schoenen has attached the following file: