maciek717 Posted August 3, 2017 Report Share Posted August 3, 2017 Hello, I've mono display (1bit color) and I'm trying to use widget like List. I made my own color style, but the selected element of the list is drawn as white box which covered item label. It's possible to use list with mono display? const GWidgetStyle MonoStyle = { HTML2COLOR(0x000000), // window background HTML2COLOR(0xFFFFFF), // focused // enabled color set { HTML2COLOR(0xFFFFFF), // text HTML2COLOR(0xFFFFFF), // edge HTML2COLOR(0xcccccc), // fill HTML2COLOR(0xFFFFFF) // progress - active area }, // disabled color set { HTML2COLOR(0x808080), // text HTML2COLOR(0x404040), // edge HTML2COLOR(0x404040), // fill HTML2COLOR(0x004000) // progress - active area }, // pressed color set { HTML2COLOR(0x000000), // text HTML2COLOR(0xFFFFFF), // edge HTML2COLOR(0xFFFFFF), // fill HTML2COLOR(0xFFFFFF) // progress - active area } }; Thanks! Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted August 3, 2017 Report Share Posted August 3, 2017 Hello and welcome to the µGFX community! The list widget uses the fill property of the widget style to highlight the currently selected item (line 782 in /src/gwin/gwin_list.c). A display driver for a monochrome display controller usually interprets the color 0x000000 as black and everything else as white (or what ever the two colors will be). Currently you set all your values to non-zero values. Try setting the fill property to 0x000000. However, that will most likely not be satisfying as you'll no longer get a visual indication for which item is currently selected. In that case, you want to write a custom rendering function for the list widget so you can either invert the colors of the currently selected item or you can add some sort of arrow indicator. Writing a custom rendering routine is very simple, there's a guide: https://wiki.ugfx.io/index.php/Creating_a_custom_rendering_routine You'd usually start of by copying the built-in rendering function and then modifying it to your needs. I hope that helped. Link to comment Share on other sites More sharing options...
inmarket Posted August 3, 2017 Report Share Posted August 3, 2017 We have not done a lot of testing with monochrome displays and gwin. When we get time we will look at it more closely and perhaps create a special b&w color style. In the mean time a custom renderer like @joel mentioned above will solve the problem. Perhaps someone else in the community using gwin with a monochrome display would like to comment and provide some tips? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now