Can I get the typing (input) event in cinema 4d?
-
Hi everyone!
I am currently trying to capture keyboard shortcuts using a third-party Python library.
While I can successfully detect global hotkeys, I've encountered an issue where the hotkey (for instance, "a" in this case) triggers the corresponding code execution even when I'm typing(rename an object, searching something...e.t.c) within C4D.
This means the hotkey event is captured regardless of the context, which has become a little bit complicated. I had not anticipated this behavior initially.So, I'm wondering if it's possible to specifically detect input events within C4D, so that I can skip the global hotkey detecting when typing.
Another related issue is whether I can determine if the Cinema 4D window is currently active or not, because even when I'm working on other applications, the hotkey is still being monitored and triggered.
-
Hey @gheyret,
Thank you for reaching out to us.
- To capture input events you might want to have a look at the aptly named Input Events Manual. In principal you are capable of polling the global input event stream. But in some cases events are consumed before you can get hold of them (e.g., a user typing in Rename field) but that is probably what you want here. When you do not have a
GeDialog
or derived type, you likely want to use a thread to do the constant polling. - If Cinema 4D is in focus or not, is not something that is exposed in the public API. You would have to use the respective OS libraries to do this yourself (or one of the popular wrappers for such stuff).
Cheers,
Ferdinand - To capture input events you might want to have a look at the aptly named Input Events Manual. In principal you are capable of polling the global input event stream. But in some cases events are consumed before you can get hold of them (e.g., a user typing in Rename field) but that is probably what you want here. When you do not have a
-
Hi @ferdinand,
Thank you for your reply.
And I will try it later today.