It just dawned on me that with ImGui
if(CollapsingHeader("MyHeader"))
{
if(Button("B"))
{
// Do stuff
}
}
Results in a different rendering than:
if(CollapsingHeader("MyHeader"))
{
}
if(Button("B"))
{
// Do stuff
}
With the first the button is nested in the header, with the second it is outside the header. How on earth can ImGui tell that in the first version the button function is nested within the if but that in the second it isn't?