-
-
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
Toggling collapsing headers #7349
Comments
Could you explain why you want this behavior? It sounds very non-standard. There is no built-in way to accomplish this, but you could tweak Line 6297 in 277ae93
You'd probably want to add your own flag to |
I want it to behave like that so I can have both a checkbox and a header in one. I'll try your suggested method but anyways ty for the help |
In that case you might actually be better served by using static bool CheckableCollapsingHeader(const char* label, bool* v, ImGuiTreeNodeFlags flags = 0)
{
ImGui::PushID(label);
bool is_open = ImGui::CollapsingHeader("##CollapsingHeader", flags | ImGuiTreeNodeFlags_AllowOverlap);
ImGui::SameLine();
ImGui::Checkbox("##Checkbox", v);
ImGui::SameLine();
ImGui::Text("Header"); // (Label submitted as text so the user can click it to toggle the header instead of the checkbox)
ImGui::PopID();
return is_open;
}
static void GH7349()
{
ImGui::Begin("GH-7349");
static bool toggle;
if (CheckableCollapsingHeader("Header", &toggle))
{
ImGui::Text("Expanded!");
}
ImGui::Text("Header %s checked!", toggle ? "is" : "is not");
ImGui::End();
} Here's what that looks like: |
Oh this will work pretty good, I’ll do this instead. Thank you for the help |
Version/Branch of Dear ImGui:
Version 1.90.4 WIP
Back-ends:
imgui_impl_win32.cpp
Compiler, OS:
Windows 10
Full config/build information:
No response
Details:
Is there a way to open/close collapsing headers with other mouse buttons? I'm trying to toggle a collapsing header with right-click but I can't figure out any way to do it. Maybe in the future there could be some sort of field/flag for using other mouse buttons.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: