You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is about two things, but fixing the first leads to the second problem.
The first is, the demo property editor is maybe missing a PushID/PopID() call. This can be seen when adding a InputText to the example. The attached code adds a InputText to edit the name of the property.
Now changing the name in the InputText and then imediately clicking onto an other node changes also the name of the second node. I think this happens due to the InputText always having the exact same ID, so I would guess this could be seen as ID conflict.
To solve this I added PushID() / PopID() calls pushing the node pointer to the ID stack, so every property widget ID is unique across all nodes. (This is commented out in the example below).
But unfortunately this also creates a new ID for the table of every node, so state isn't shared anymore between the tables of each node. So, e.g., resizing the property editor table on one node is not global anymore but purely for that specific node. I have found other issues suggesting PushOverrideID to globally share table state, but then also the ID will be the same for all widgets inside the table and I'm back to the first issue above.
Is there some way to globally share table state (e.g. using PushOverrideID) only for the table itself but keep the original ID stack inside the table? Or as alternative, I only require the resize state, is the column width somehow bindable to an external variable to be shared between tables?
Thank you @moritz-h for posting this and the details.
You are correct about your suggestion, however note that there's a much simpler workaround: move the per-node PushID() call inside the Table. This is what I've done with 2f1194a.
Using PushOverrideID() would also be possible albeit a little more cumbersome. I am currently hesitant to make PushOverrideID() idea because I have a plan to solve #331 with the same solution we are using in Test Engine, aka to support leading markers such "../" to easily access other levels of the ID stack. (See https://github.com/ocornut/imgui_test_engine/wiki/Named-References for Test Engine support of this).
(As a tangential small convenience I've also added the ImGuiDataType_String enum to public API 80aafbc)
Version/Branch of Dear ImGui:
v1.91.6-docking
Back-ends:
imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler, OS:
Windows 11 + MSVC 2022
Full config/build information:
No response
Details:
My Issue/Question:
This issue is about two things, but fixing the first leads to the second problem.
The first is, the demo property editor is maybe missing a PushID/PopID() call. This can be seen when adding a InputText to the example. The attached code adds a InputText to edit the name of the property.
Now changing the name in the InputText and then imediately clicking onto an other node changes also the name of the second node. I think this happens due to the InputText always having the exact same ID, so I would guess this could be seen as ID conflict.
To solve this I added PushID() / PopID() calls pushing the node pointer to the ID stack, so every property widget ID is unique across all nodes. (This is commented out in the example below).
But unfortunately this also creates a new ID for the table of every node, so state isn't shared anymore between the tables of each node. So, e.g., resizing the property editor table on one node is not global anymore but purely for that specific node. I have found other issues suggesting PushOverrideID to globally share table state, but then also the ID will be the same for all widgets inside the table and I'm back to the first issue above.
Is there some way to globally share table state (e.g. using PushOverrideID) only for the table itself but keep the original ID stack inside the table? Or as alternative, I only require the resize state, is the column width somehow bindable to an external variable to be shared between tables?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Patch for imgui_demo.cpp @ v1.91.6-docking
The text was updated successfully, but these errors were encountered: