silageman Posted February 22, 2022 Share Posted February 22, 2022 Can anyone give me an example? do I have to create a custom widget or can I do this with the included widgets for example add text line edit on button press while the app is running. Quote Link to comment Share on other sites More sharing options...
silageman Posted February 23, 2022 Author Share Posted February 23, 2022 #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Add Buttons", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); auto ui = CreateInterface(window); auto sz = ui->root->ClientSize(); array<shared_ptr<Widget>, 10> btn; int inc = 0; int space = 0; btn[0] = CreateButton("add", 0, 0, 100, 100, ui->root); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if(ev.source == btn[inc]){ space=space+100; btn[inc+1] = CreateButton("+", 0,space, 100, 100, ui->root); Print(inc); inc= inc+1; break; } break; case EVENT_WINDOWCLOSE: return 0; break; } } } 1 Quote Link to comment Share on other sites More sharing options...
silageman Posted February 23, 2022 Author Share Posted February 23, 2022 so deleting these works too but leaves empty space any widget that will automatically redraw on btn deletion? Quote 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.