Registering additional callbacks to glfw without overriding previous ones. #394
-
|
As the title suggests I'm interested in adding additional methods to callbacks in python imgui_bundle without overriding already added callback functions. I tried following the instructions on the main page regarding "Advanced GLFW Callbacks" but it's not working out for me. Since the integral callbacks have been overwritten, UI no longer responds to any input commands such as mouse hovering, typing, clicking etc.. What am I doing wrong? I know that imgui_bundle comes with its own io properties but I find the glfw approach with registering callbacks more intuitive and easier to read and syntactical "correct" (I know what I've just said here is subjective and probably doesn't make a lot of sense). Apologies if I'm asking questions that should have an obvious answer. I also realize that the author as well as other contributors have better things to do, but trust me when I tell you I've skimmed through available demos as well as documentation and I couldn't find anything that answers my question. Here's an example of what I have so far: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi, If you use Hello ImGui and/or ImmApp, then they are responsible for handling the mouse and keyboard callbacks. When using hello_imgui or immapp, registering additional callbacks to glfw without overriding previous ones is not possible at the moment, and I'm not sure it is desirable. Basically the existing callbacks will transmit the info to ImGui. Concerning your problem you may have several solutions. Option 1: Instead of changing the mouse callbacks, ask ImGui about the mouse status See below an image which shows that imgui can give a lot of info about the mouse (and keyboard) status. Option 2: use a full python backend If you really desire to change these callbacks, I would assume that you want to control the full gui loop. In this case, you may use a full python backend (and not use Hello Imgui, ImmApp). See example_python_backend_glfw3.py, and see how the callbacks are implemented in python here in glfw_backend.py Note: when using a full python backend you lose some features provided by Hello ImGui (such a FPS throttling / CPU saver): you are in control of the full loop. I suppose however that this is what you are looking for. |
Beta Was this translation helpful? Give feedback.

Hi,
If you use Hello ImGui and/or ImmApp, then they are responsible for handling the mouse and keyboard callbacks.
When using hello_imgui or immapp, registering additional callbacks to glfw without overriding previous ones is not possible at the moment, and I'm not sure it is desirable. Basically the existing callbacks will transmit the info to ImGui.
Concerning your problem you may have several solutions.
Option 1: Instead of changing the mouse callbacks, ask ImGui about the mouse status
See below an image which shows that imgui can give a lot of info about the mouse (and keyboard) status.
Option 2: use a full python backend
If you really desire to change these callbacks, I would assume…