Get window handle pointer to add content with Begin and End?

Heya, loving using Dear ImgGUI.

I have a question for an application I’m preparing/designing before I’m writing. Is it possible to Begin/End a main application window, and get the frame/window ID for passing to other classes/modules within the program who might want to add UI content to that original window?

So lets say I create a default window layout, and then another module says “oh hey I want to add an image and a table of data points to the end of the main window’s content”, how do I “Begin/End” and do the usual GUI elements in the original window?

I want to roll up a default GUI with a bunch of extra windows/content provided by other modules in my program, before the Render function is called.

is there a better way to structure what i’m trying to do?

Thanks for any pointers (just not null ones please lol)

You can Begin/End multiple time in the same window (using the same name/id) and it’ll append. However it’ll become your responsability to order those calls in a way that makes sense.

The window flags and bool* open are only handled in the first call to Begin() for a given window.

Thanks mate!

Is it perhaps better design for me to provide a dockable area in the main GUI window, and when my other classes/modules in my application present their own windows as dockable windows to the main GUI code, the windows can be docked and handled that way?

If the module is removed or killed (destructed) and stops running its GUI code the main GUI window can delete/eject/undock the window which was provided by that module…

Is all that I describe possible within the imgui API? What would you recommend?

Yes that would be preferable.
There’s almost nothing to write to accomplish that. You can merge/dock any window with docking enabled. You may create a Dockspace if you want to dock into a fixed window.

Because dear imgui is very unusual in its structure, generally you should generally explore the imgui_demo code and what it does live, rather than devising a master plan outside of where it is best for.

Thank you for your responses. I did explore the imgui_demo a bit, which has helped me work out some other features.

Is Docking and Dock Spaces available in v1.71? Or do I need the “Docking” branch from github?

I presume if you looked you would find the answer.

haha well fair enough. I looked through the demo.cpp and couldn’t find anything about dock or docking.

So from further investigation, what I really need is just a tab bar, and each of my classes can just provide the content for its own tab. This works fine for me simple application, and from some prototyping I proved that I can start the tab bar and then call external functions (from each class) to create and fill out content in a tab, and it works just fine.