Jump to content

Container fill color


TheProdigalCat

Recommended Posts

Hello guys.

I'm playing with uGFX library.

How I can fill my containers with diffrent background colors? For example I have 3 containers with buttons, labels and progressbars. I want fill container 1 red, container 2 green and container 3 blue color? How I can do i?

Thanks.

Edited by TheProdigalCat
Link to comment
Share on other sites

For this you need to change the style either during the initialization or with gwinSetStyle.

Something like this should work:

    const GWidgetStyle MyCustomStyle = {
        HTML2COLOR(0xFF0000),       // window background
    };

    GWidgetInit wi;

    // Apply some default values for GWIN
    gwinWidgetClearInit(&wi);
 
    // Apply the container parameters
    wi.g.show = FALSE;
    wi.g.width = 200;
    wi.g.height = 150;
    wi.g.y = 10;
    wi.g.x = 10;
    wi.text = "Container";
    wi.customStyle = &MyCustomStyle;
    ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);
    wi.g.show = TRUE;

More info on styles is on https://wiki.ugfx.io/index.php/Widgets

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...