zwcloud / ImGui

Immediate Mode GUI for C#
https://zwcloud.net/#project/imgui
GNU Affero General Public License v3.0
197 stars 21 forks source link

dynamic layout issue: controls inside a CollapsingHeader are always shown after all existing controls #35

Closed zwcloud closed 4 years ago

zwcloud commented 4 years ago

code to reproduce:

public void ShowTwoCollapsingHeader()
{
    Application.IsRunningInUnitTest = true;
    Application.Init();

    var form = new MainForm();
    bool open1 = false, open2 = false;
    form.OnGUIAction = () =>
    {
        if (GUILayout.CollapsingHeader("Header 1", ref open1))
        {
            GUILayout.Label("Item A");
            GUILayout.Label("Item B");
        }
        if (GUILayout.CollapsingHeader("Header 2", ref open2))
        {
            GUILayout.Label("Item C");
            GUILayout.Label("Item D");
        }
    };

    Application.Run(form);
}

result: dynamic_layout_collapsingheader_issuee