Button SKIN - change button colour upon button press.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • 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
  • 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
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.