On 18/02/2017 at 12:11, xxxxxxxx wrote:
I try to detect mousewheel into an async dialog. Cause in tab that change the tab and I want to avoid this.
Here is my try but unfortualy that didn't work
res = c4d.BaseContainer() bc = c4d.BaseContainer() c4d.gui.GetInputEvent(c4d.BFM_INPUT_MOUSE, bc) if bc.GetInt32(c4d.BFM_INPUT_CHANNEL) == c4d.BFM_INPUT_MOUSEWHEEL: print bc.GetReal(c4d.BFM_INPUT_VALUE) if msg.GetId() == c4d.BFM_INPUT: if msg.GetInt32(c4d.BFM_INPUT_DEVICE) == c4d.BFM_INPUT_MOUSE: if msg.GetInt32(c4d.BFM_INPUT_CHANNEL) == c4d.BFM_INPUT_MOUSEWHEEL: print 'wheel' return True elif msg.GetInt32(c4d.BFM_INPUT_CHANNEL) == c4d.BFM_INPUT_MOUSELEFT: print 'left'
It's called from my Message function of my GeDialog
On 20/02/2017 at 02:45, xxxxxxxx wrote:
To perform mouse/keyboard detection it's better to use a GeUserArea as it gives better results.
The mouse wheel can be detected in a GeUserArea Message() with the code you posted that manipulates the msg container passed directly from Cinema. Using GetInputEvent() there leads to weird results.
Also the right-click can be detected from a GeUserArea Message() (cf. last week topic).
If the function return in such case before calling GeUserArea.Message(self, msg, result), then the default popup menu doesn't show up. You can use the same logic for preventing the tab changes.
On 20/02/2017 at 03:11, xxxxxxxx wrote:
Thanks for the reply. Unfortually I don't want to do anything with the mousewheel. I just want to avoid the default behavior of it into a tab. Which make switching the tab.
Then it's why I thinked to detect the mousewheel operation into my gedialog (since my tab is in it and as I know I can't make a tab into a GeUserArea).
Maybe I'm doing it in the wrong way and you have a better idea for removing the behavior of the mousewheel and tab.
But maybe I can make an empty GeUserArea just for getting the mousewheel and right click, then set variable about state. And then in the message function of my Gedialog check for the variable state of the GeUserArea and doing some stuff.
Thanks in advance !