-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Ui.collapsing does not work with multiple Ui.collapsing of the same name after version 0.27.0 #4265
Comments
The collapsing header needs a unique Id to store its state ('am i collapsed or not'). When using Use If you compile with |
Is it possible to retain the functionality to purposefully share the same |
Here is an example that does what you are asking for: egui::CentralPanel::default().show(ctx, |ui| {
(1..=5).for_each(|i| {
let header = format!("header {}", i % 2);
let open_id = egui::Id::new(&header);
let open = ui
.data_mut(|data| data.get_persisted(open_id))
.unwrap_or(false);
let toggle = CollapsingHeader::new(header)
.id_source(("different id", i))
.open(Some(open))
.show(ui, |ui| ui.label(format!("Body {i}")))
.header_response
.clicked();
if toggle {
ui.data_mut(|data| data.insert_persisted(open_id, !open));
}
});
}); Screencast.from.2024-03-29.19-28-45.webm(If you don't want the open state to be persisted to the disk, use |
You're a legend thanks a bunch i learned quite a lot from that example |
Describe the bug
using ui.collapsing in a scrollarea with multiple ui.collapsing in with the same name causes issues with clicking on them aswell as closing them it seems the only the bottom one can be clicked on i have videos below
Expected behavior
Here is a video using egui version '0.26.2'
Synopsis: I can click on all the elements with no problem, and clicking on any of them will trigger the rest to open and close without any issues.
Version.0.26.2.mp4
Here is a video of egui version 0.27.1 and 0.27.0 does the same thing as 0.27.1
Synopsis: After version 0.27.0, I can't click on all the elements, only the very bottom one. And when I do, sometimes it opens; other times, it opens then closes as well. When it opens, it seems to glitch while scrolling down, going up, then back down a little. All this stops happening if you have one ui.collapse with a different name. In the video below, I called it "hi," and you can see that the element works with no problems.
Version.0.27.1.mp4
Desktop information):**
The text was updated successfully, but these errors were encountered: