Skip to content

Add UiBuilder::global_scope and UiBuilder::id#7372

Merged
emilk merged 2 commits intoemilk:mainfrom
Icekey:fixid
Aug 5, 2025
Merged

Add UiBuilder::global_scope and UiBuilder::id#7372
emilk merged 2 commits intoemilk:mainfrom
Icekey:fixid

Conversation

@Icekey
Copy link
Copy Markdown
Contributor

@Icekey Icekey commented Jul 18, 2025

I added a new flag to the UiBuilder so that it is possible to move child widgets around the ui tree without losing state information.
Currently there is no way to create child widgets with the same id at different locations in the ui tree since ids change in relation the the parent id. With the new flag a unique global scope can be created which always results in the same ids even at different locations.
You still need to ensure that the widgets only get rendered once in frame.

This feature can be used to fix a issue i am having with the https://github.com/lucasmerlin/hello_egui crate.

@github-actions
Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/7372-fixid
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin added feature New feature or request egui labels Jul 22, 2025
Copy link
Copy Markdown
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Icekey
Copy link
Copy Markdown
Contributor Author

Icekey commented Jul 26, 2025

How does merging work?

@lucasmerlin
Copy link
Copy Markdown
Collaborator

I usually go through all approved PRs with @emilk every tuesday, but hes on holiday right now so it'll have to wait until next tuesday.

@emilk emilk changed the title added global_scope flag to UiBuilder Add UiBuilder::global_scope and UiBuilder::id Aug 5, 2025
@emilk emilk merged commit e9afd3c into emilk:main Aug 5, 2025
26 checks passed
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
I added a new flag to the UiBuilder so that it is possible to move child
widgets around the ui tree without losing state information.
Currently there is no way to create child widgets with the same id at
different locations in the ui tree since ids change in relation the the
parent id. With the new flag a unique global scope can be created which
always results in the same ids even at different locations.
You still need to ensure that the widgets only get rendered once in
frame.

This feature can be used to fix a issue i am having with the
https://github.com/lucasmerlin/hello_egui crate.


* Closes lucasmerlin/hello_egui#75
* [X] I have followed the instructions in the PR template

---------

Co-authored-by: Emil Ernerfeldt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sizing problem with CollapsingHeader in dnd

3 participants