Single Window Apps
A single window app is an AppCUI application where you only have one window that ocupies the entire desktop. Usually, when you create a AppCUI app, you can add multiple windows to a desktop object. In this mode you can only add one window, and terminating that window will close the app.
To do this you need to use App::single_window(...) as follows. The factory can be a closure or a function / constructor with no arguments (MyWin::new):
App::single_window(|| {
// construct the one and only window
window!("Demo,d:f")
}).run()
// equivalent when `new` takes no arguments:
App::single_window(MyWin::new).run()
Remarks
- in a
Single Windowmode you can not set a custom desktop as there is only one window and it covers the entire visible size of a desktop..desktop(...)is only available on the multi-window builder (App::new()). - Since in a
Single Windowmode there is only one window, the factory passed toApp::single_window(...)is invoked once and must return that window. You can not register a second window. - Since in a
Single Windowmode the window ocupies the entire visible size of a desktop, you can not resize or move it. As such, window flag attributes likeSizeableare not allowed. If used, the code will panic. The layout (regardless on how you set it up) will be changed to make sure that the window ocupies the entire visible desktop space.// the following line will panic as Sizeable flag is not allow on windows in Single Window mode App::single_window(|| window!("Test,a:c,flags: Sizeable")).run()