reepblue Posted November 25, 2023 Share Posted November 25, 2023 I'm having a hard time understanding the Scroll Panel widget found here. I tried parenting my custom panels to the subpanel pointer, but it doesn't draw the sliderbar. A main example would be appreciated as I need this for my settings panel. 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 November 27, 2023 Solution Share Posted November 27, 2023 Parent your widgets to scrollpanel->subpanel. Call SetArea to set the size of the entire subpanel. The widget will take care of the rest. 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...
reepblue Posted November 27, 2023 Author Share Posted November 27, 2023 Got it, here's a main.cpp example. I may want to consider revamping my settings panel since I now understand this. #include "UltraEngine.h" #include "CustomWidgets/ScrollPanel.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Load plugins auto plugin_svg = LoadPlugin("Plugins/SVG.*"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_RESIZABLE); //Create User Interface auto ui = CreateInterface(window); auto sz = ui->root->ClientSize(); auto scrollpanel = CreateScrollPanel(0, 0, sz.x, sz.y, ui->root); scrollpanel->SetLayout(1, 1, 1, 1); //Parent your widgets to scrollpanel->subpanel. auto panel = CreatePanel(0, 0, sz.x - 100, sz.y - 100, scrollpanel->subpanel); panel->SetColor(0, 0, 0, 1); //Call SetArea to set the size of the entire subpanel. scrollpanel->SetArea(1000, 1000); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } 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...
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.