Skip to content
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

Use parent elements ui for the style for popup #4324

Closed
alexparlett opened this issue Apr 5, 2024 · 1 comment · Fixed by #4325
Closed

Use parent elements ui for the style for popup #4324

alexparlett opened this issue Apr 5, 2024 · 1 comment · Fixed by #4325

Comments

@alexparlett
Copy link
Contributor

alexparlett commented Apr 5, 2024

Is your feature request related to a problem? Please describe.
Unable to style the popup from the parent (i.e. combox box) due to it using the root ctx and a new ui associated with that, meaning that any style changes made are reset back to default.

Describe the solution you'd like
Honour the style from the parent elements ui instead of using the root style.

Describe alternatives you've considered
You can manually implement a scope function storing the previous root style, changing it and then restoring if after you function has run.

Additional context

ui.style_mut().visuals.window_fill = egui::Color32::RED;

egui::ComboBox::from_id_source("window-mode-selector")
                                    .selected_text(format!("{}", self.display_settings.window_mode))
                                    .icon(filled_triangle)
                                    .width(ui.available_width())
                                    .show_ui(ui, |ui| {
                                        ui.selectable_value(
                                            &mut self.display_settings.window_mode,
                                            WindowMode::Fullscreen,
                                            format!("{}", WindowMode::Fullscreen),
                                        );
                                        ui.selectable_value(
                                            &mut self.display_settings.window_mode,
                                            WindowMode::Windowed,
                                            format!("{}", WindowMode::Windowed),
                                        );
                                    });
@alexparlett alexparlett changed the title Use combo box's ui for the style for drop down popup Use parent elements ui for the style for drop down popup Apr 5, 2024
@alexparlett alexparlett changed the title Use parent elements ui for the style for drop down popup Use parent elements ui for the style for popup Apr 5, 2024
@alexparlett
Copy link
Contributor Author

@emilk - any view on whether this is something that might be changed at source or should we build our own version of combo boxes and popups.

Just asking as currently we're using a custom fork and I'd rather not diverge from base egui as the dependency.

emilk pushed a commit that referenced this issue Apr 21, 2024
* Closes <#4324>

---------

Co-authored-by: Alex Parlett <[email protected]>
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Closes <emilk#4324>

---------

Co-authored-by: Alex Parlett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant