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
Detect mouse over any ImGUI window #52
Comments
Additionally, I would really like a way to give keyboard focus to a specific text field... |
xythobuz: separate issue/thread please. |
Mattias: I suspect that your underlying question is that you'd like to know when to pass your inputs to ImGui, i am right ? In the IO structure you can find: This is updated by NewFrame() so the idea is that you pass your raw inputs to ImGui but it doesn't necessary use them. If the flag aren't set you can pass the inputs back to the rest of your application. Now, through various feedbacks it appears that this was confusing to some engine architecture, e.g. if you are trying to dispatch inputs events directly to the right target. My suggestion would be to just store data and pass it to ImGui before NewFrame(). You can set io.MousePos and call ImGui::IsMouseHoveringAnyWindow() to test if a position is over a window. Detect if a widget has focus for keyboard is IO.WantCaptureKeyboard. I think I need to revamp those API to be a little more clear. Perhaps adding an explicit WidgetHasFocus thing? |
Yes, thanks for the information! This setup sounds good to me, since I just need to know when to block input to my code. |
I want to do something similar to this. (using sfml) i render my main application to a sf::RenderTexture that i then display on ImGui::Image(). So basically my dockspace and my whole window is at all times completely covered by ImGui windows. So when i try to dispatch mouse clicks to my application i want to check if io.WantCaptureMouse. I read at many places that io.WantCaptureMouse is prefered over IsWindowHovered(). Edit: |
This is more of a question. How do I detect if the mouse is currently over any ImGui window? Is this supported? Also, how do I detect if any input box currently has focus?
The text was updated successfully, but these errors were encountered: