mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 14:36:34 +00:00
TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless. Tweak demo.
This commit is contained in:
parent
99ff6fc7e4
commit
640c056602
@ -44,6 +44,7 @@ Breaking Changes:
|
||||
Other Changes:
|
||||
|
||||
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
|
||||
- TreeNode: Fixed nodes with ImGuiTreeNodeFlags_Leaf flag always returning true which was meaningless.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
|
@ -8109,7 +8109,7 @@ void ImGui::LogButtons()
|
||||
bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
|
||||
{
|
||||
if (flags & ImGuiTreeNodeFlags_Leaf)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
// We only write to the tree storage if the user clicks (or explicitly use SetNextTreeNode*** functions)
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
@ -457,7 +457,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
else
|
||||
{
|
||||
// Leaf: The only reason we have a TreeNode at all is to allow selection of the leaf. Otherwise we can use BulletText() or TreeAdvanceToLabelPos()+Text().
|
||||
node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet
|
||||
node_flags |= ImGuiTreeNodeFlags_Leaf; // | ImGuiTreeNodeFlags_Bullet;
|
||||
ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Leaf %d", i);
|
||||
if (ImGui::IsItemClicked())
|
||||
node_clicked = i;
|
||||
@ -3188,13 +3188,9 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here we use a TreeNode to highlight on hover (we could use e.g. Selectable as well)
|
||||
ImGui::AlignTextToFramePadding();
|
||||
// Here we use a Selectable (instead of Text) to highlight on hover
|
||||
//ImGui::Text("Field_%d", i);
|
||||
char label[32];
|
||||
sprintf(label, "Field_%d", i);
|
||||
ImGui::Bullet();
|
||||
ImGui::Selectable(label);
|
||||
ImGui::TreeNodeEx("Field", ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet, "Field_%d", i);
|
||||
ImGui::NextColumn();
|
||||
ImGui::PushItemWidth(-1);
|
||||
if (i >= 5)
|
||||
|
Loading…
Reference in New Issue
Block a user