reepblue Posted January 29, 2023 Share Posted January 29, 2023 This example shows that if the theme of the UI is changed, the menu bar dropdown lists fail to update it's background. This might happen with other widgets if this functionality is shared with other widgets. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0]); //Create user interface auto ui = CreateInterface(window); //Create widget iVec2 sz = ui->root->ClientSize(); auto button_dark = CreateButton("Dark Theme", sz.x / 4 - 75, sz.y / 4 - 15, 150, 30, ui->root); auto button_light = CreateButton("Light Theme", sz.x / 4 * 3 - 75, sz.y / 4 - 15, 150, 30, ui->root); //File menu auto mainmenu = CreateMenu("", ui->root); auto menu_file = CreateMenu("File", mainmenu); CreateMenu("New", menu_file); CreateMenu("", menu_file); auto menu_open = CreateMenu("Open", menu_file); auto menu_save = CreateMenu("Save", menu_file); auto menu_saveas = CreateMenu("Save as...", menu_file); CreateMenu("", menu_file); auto menu_recentfiles = CreateMenu("Recent files", menu_file); std::array<shared_ptr<Widget>, 10> menu_recentfile; for (int n = 0; n < menu_recentfile.size(); ++n) { menu_recentfile[n] = CreateMenu("Recent file " + String(n + 1), menu_recentfiles); } CreateMenu("", menu_file); auto menu_exit = CreateMenu("Exit", menu_file); //Edit menu auto menu_edit = CreateMenu("Edit", mainmenu); CreateMenu("Undo", menu_edit); CreateMenu("Redo", menu_edit); CreateMenu("", menu_edit); CreateMenu("Cut", menu_edit); CreateMenu("Copy", menu_edit); CreateMenu("Past", menu_edit); CreateMenu("", menu_edit); CreateMenu("Select all", menu_edit); CreateMenu("Select none", menu_edit); CreateMenu("Invert selection", menu_edit); //View menu auto menu_view = CreateMenu("View", mainmenu); auto menu_perspective = CreateMenu("Perspective", menu_view); auto menu_top = CreateMenu("XZ - Top", menu_view); auto menu_side = CreateMenu("XZ - Side", menu_view); auto menu_front = CreateMenu("XY - Front", menu_view); menu_perspective->SetState(true); //Tools menu auto menu_tools = CreateMenu("Tools", mainmenu); auto menu_options = CreateMenu("Options", menu_tools); //Help menu auto menu_help = CreateMenu("Help", mainmenu); auto menu_helpcontents = CreateMenu("Help Contents", menu_help); auto menu_about = CreateMenu("About", menu_help); //Text area auto textarea = CreateTextArea(8,sz.y/2,sz.x-16,sz.y/2-8,ui->root); textarea->SetText(LoadString("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Themes/dark.json")); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if (ev.source == button_dark) { //Load dark color scheme ui->LoadColorScheme("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Themes/dark.json"); textarea->SetText(LoadString("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Themes/dark.json")); } else if (ev.source == button_light) { //Load light color scheme ui->LoadColorScheme("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Themes/light.json"); textarea->SetText(LoadString("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Themes/light.json")); } break; case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; } } return 0; } 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Solution Josh Posted January 29, 2023 Solution Share Posted January 29, 2023 This will be fixed in an update today. I also found combo boxes had the same issue, and I fixed that too. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.