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

Widgets not response when using interact() #2947

Open
Dicklessgreat opened this issue Apr 22, 2023 · 2 comments
Open

Widgets not response when using interact() #2947

Dicklessgreat opened this issue Apr 22, 2023 · 2 comments
Labels
bug Something is broken

Comments

@Dicklessgreat
Copy link

Dicklessgreat commented Apr 22, 2023

Describe the bug

I upgraded my egui version from 0.19.0 to 0.21.0 yesterday, and the widgets in the areas that use Ui::interact() are no longer responding to mouse events.
They do not react in 0.21.0, 0.20.0, but they did in 0.19.0, which is what I was using.
It seems that the mouse events are completely overwritten by ui::interact.
Is this the expected behaviour?
To Reproduce
Steps to reproduce the behavior:

  1. Let's create a project from eframe_template.

Add a line ui.interact(ui.min_rect(), egui::Id::new("Some Id"), egui::Sense::click()) between line 92 and 93 of app.rs.
0.21.0 and 0.20.0
egui_widget_not_response
0.19.0
egui_widget_response
3. The SidePanel widget responds in 0.19.0, but not in 0.20.0 and 0.21.0. Nothing happens when you click on them, and they do not highlight when you hover over them.
4. Note that the hyperlinks in the CentralPanel works fine as it does not contain interact().

Expected behavior

I was expecting behaviour as in 0.19.0.

Desktop (please complete the following information):

  • OS: Windows10
@temportalflux
Copy link

I'm also seeing this when using context_menu on the response from a egui_extras::TableRow::col. For some tables the interaction works, while others it is ignored, even when the tables are in separate windows.

	pub fn col(&mut self, add_contents: impl FnOnce(&mut egui::Ui)) -> egui::Response {
		let (_, response) = self.row.col(add_contents);
		let response = response.context_menu(|ui| {
			self.context_menu(ui, self.col_count);
		});
		self.col_count += 1;
		response
	}

@Dicklessgreat
Copy link
Author

Referring to #2244, this seems like the expected behaviour.
So I would like to ask, how can I know if a certain area is clicked without Responses from Widgets?

In the eframe_template example I showed before, I want to know if "Side Panel" is clicked or not without direct response from Button, Slider, TextEditor (that's why I added ui.interact()).
The reason why I want to do it is that, imagine you have tens or hundreds of widgets in "Side Panel" and you want a "Side Panel has clicked" event besides "each widgets has clicked" event, writing event handling code every time you add a widget is a waste of time.
So I'd like a "global" method to get events of a certain area. Is there a way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants