how get a widget and use it ?

Started by che2a, 26 May 2020, 13:37:35

che2a

Hello, when i get a widget i have a widget::ptr

But i need to get the widget to use moveToFront() because he is displayed behind an another widget

I need to do something like that :
Code (cpp) Select

tgui::MenuBar::Ptr widget = gui->get<tgui::MenuBar>("MenuBar");
widget->moveTofront();


Thank you

texus

#1
Code like that exists, you just need to make the "f" a capital letter (moveToFront instead of moveTofront).

If you don't need to call any function specific to MenuBar then you can skip the cast to MenuBar and have code that works for any type of widget:
Code (cpp) Select
tgui::Widget::Ptr widget = gui->get("MenuBar");
widget->moveToFront();

che2a

Thank you it works !

And thank you for your work tgui is awesome :)