davetcc / tcMenu

Menu library for Arduino, mbed and ESP with designer UI and remote control capabilities.
https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/
Apache License 2.0
272 stars 25 forks source link

Background color changed after changing factory.setDrawingPropertiesForItem #330

Closed davetcc closed 1 year ago

davetcc commented 1 year ago

Raised by davetcc

From discussion, bug in tcMenu rendering where the renderer is getting tripped up by an item level override on the first item. This is causing the item level background to apply instead of the submenu level one.

Create a new function on the display properties that ignores the item level, specifically for these cases.

--

Discussed in https://github.com/davetcc/tcMenu/discussions/329

Originally posted by **futurexdesign** April 12, 2023 I have an interface as such: TitleBar EditableTextMenuItem (displaying a timer countdown) Grid of 4 action items represented by icons. I am using DarkModeModern on an LCD. I want my timer section to be centered, with a white background and black text, but the rest of the ui to retain the black background. The issue I'm having is, after I set the drawing properties for the timer menu entry, all of the "empty" space below the grid row has become white. I'm calling ``` MenuPadding perSidePadding(4, 4, 4, 4); const color_t timmerPalette[] = {RGB(0, 0, 0), RGB(255,255,255), RGB(255,255,255), RGB(255,255,255)}; factory.setDrawingPropertiesForItem(ItemDisplayProperties::COMPTYPE_ITEM, menuTimeRemaining.getId(), timmerPalette, perSidePadding, MenuFontDef(nullptr, 7).fontData , MenuFontDef(nullptr, 7).fontMag, 2, 60, GridPosition::JUSTIFY_CENTER_VALUE_ONLY, MenuBorder(1)); ``` in setup after `setupMenu()`. I'm just not entirely sure why the remaining background has become white. As a test, I tried adding another dummy menu time after the grid row, which renders correctly (in black background), but doesn't seem to fix the rest of the unfilled white space below the last menu. Screenshot: ![screenshot_1007](https://user-images.githubusercontent.com/8275093/231331495-36dd6db9-52c9-446d-a712-4563d37bfd91.png) Any suggestions on what to try would be appreciated.
davetcc commented 1 year ago

Closing this issue now, and leaving the library issue open