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

Impove TreeNode #66

Closed zwcloud closed 4 years ago

zwcloud commented 4 years ago

Now we need to use TreeNode like

if(TreeNode("SomeTree"))
{
    //content inside the tree
}
TreePop();

It's much better changed to

TreeNode("SomeTree")
//content inside the tree
//don't use if condition to determine whether the controls defined here are available
TreePop();

if(!TreeNode("SomeTree"))
{
     return;
}
//no need to call TreePop() if it wasn't opened
zwcloud commented 4 years ago

image