S&box Wiki

Widget Docking


The s&box editor has removable and movable secondary windows that surround the main game viewport.

If you're using a Tools.Window (internally QMainWindow) you can implement this too.



// in the constructor of your Window... // create your canvas! // the canvas widget will be the middle, with your DockWidgets surrounding it // for this example we'll use an empty widget. Canvas = new Widget( null ); // now the fun part... creating a DockWidget! // we will use FindOrCreateDock, which takes the title, icon and DockArea // the DockArea is where the DockWidget will sit (note the image above) DockWidget dockWidget = FindOrCreateDock("My Dock Widget", "bar_chart", DockArea.Bottom); dockWidget.MinimumSize = 200; // for testing! you should have content inside it though // finally, show the DockWidget! dockWidget.Show();

The Window class wraps a QMainWindow instance. To learn more about QT docking, check out https://doc.qt.io/qt-6/qtwidgets-mainwindows-dockwidgets-example.html and https://doc.qt.io/qt-6/qdockwidget.html