aiaf Posted June 26, 2021 Posted June 26, 2021 for(int i=sgen->GetInitial().size()-1; i<12; i++) { left_stack_items[i]->Hide(); } for(int i=0; i< sgen->GetInitial().size(); i++) { left_stack_items[i]->SetText(sgen->GetInitial()[i]); if(left_stack_items[i]->Hidden()) { left_stack_items[i]->Show(); } } Notify("Win!"); https://www.ultraengine.com/learn/CPP/Notify I click a button i modify some widgets in gui then i call notify. The gui does not get refreshed , there is a way to make my code above Notify to take effect ? I notice when the Notify is open , the button that triggerd this is in selected mode with blue rectangle on it. Im on ubuntu didnt try on windows. I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station
Josh Posted June 26, 2021 Posted June 26, 2021 Is it possible to provide a complete source code I can paste into main.cpp to demonstrate the problem? My job is to make tools you love, with the features you want, and performance you can't live without.
aiaf Posted June 26, 2021 Author Posted June 26, 2021 button->SetText("updated"); Notify("Button updated"); Button text only updates after you press ok, but its called first. And in my original case i didnt see the last state of the game because of this. I did my thing in another way using widgets #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("ZKonquest", 0, 0, 800, 600, displays[0]); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto tabber = CreateTabber(10, 10, sz.x - 20, sz.y - 20, ui->root); tabber->AddItem("Main", true); tabber->AddItem("Item 2"); tabber->AddItem("Item 3"); array<shared_ptr<Widget>, 3> panels; sz = tabber->ClientSize(); panels[0] = CreatePanel(0, 0, sz.x, sz.y, tabber); panels[1] = CreatePanel(0, 0, sz.x, sz.y, tabber); panels[2] = CreatePanel(0, 0, sz.x, sz.y, tabber); panels[1]->Hide(); panels[2]->Hide(); auto button = CreateButton("Button", 0, 0, 120, 30, panels[0]); float scale = displays[0]->scale; window->SetShape(0,0,470 * scale, 600 * scale); ui->SetScale(scale); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if (ev.source == button) { button->SetText("updated"); Notify("Button updated"); } break; case EVENT_WIDGETSELECT: if (ev.source == tabber) { for (int n = 0; n < tabber->items.size(); ++n) { if (n == ev.data) { panels[n]->Show(); } else { panels[n]->Hide(); } } } break; case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station
Solution Josh Posted June 28, 2021 Solution Posted June 28, 2021 I found the cause of this and fixed it for the next build. My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts