-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically closing CollaspingHeader #924
Comments
You can use |
Soory ocornut can you give me a quick code snippet example I have to have the checkbox after the CollaspingHeader on the GUI? |
Move the Checkbox() before CollapsingHeader()
|
Is it not possible to have the Checkbox() shown after the CollaspingHeader() and somehow get the same result as above? Can we access an id or something for that particular widget and change its state? |
It isn't possible at the moment. It is a missing feature.
If you need the checkbox to be below you can store your own data to call SetNextTreeNodexx on the next frame, or manipulate the cursor position to draw the checkbox first then move back upward and draw the tree node.
|
Hmm.. actually you can access the StateStorage and manually set the value corresponding to the treenode id to 0 and 1 and that would work currently.
|
Can you give me a code example of how to access the StateStorage if that would work please? |
Manipulating the state storage works and it can sometimes be a cleaner solution. With the checkbox after the header, it will happen on the next frame though. If that's acceptable, you can get the same behavior with SetNextTreeNodeOpen:
My preferred approach would be to allow the app to maintain the open state and pass in a bool* to ImGui. This would simplify dynamic manipulation and the existing entrypoints can continue to use the StateStorage mechanism. |
Yes, got it working. Thanks |
I sort of agree this would be good.
|
I have the following code snippet:
ImGui::Begin("Control Centre II", &ImGui_WindowOpened, ImVec2(0, 0), 0.5f, ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
ImGui::SetWindowPos(ImVec2(1602, 2));
ImGui::SetWindowSize(ImVec2(right_menu_width, Display::GetScreenHeight() - 2));
if (ImGui::CollapsingHeader("Image Library", 0, true, true))
{
// Do stuff
}
ImGui::Checkbox("Show Grayscale", &show_grayscale_image);
How can I dynamically force the “Image Library” CollaspingHeader to close/open when I check the “Show Grayscale” checkbox?
The text was updated successfully, but these errors were encountered: