Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    detect mousewheel

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 379 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 20/02/2017 at 02:45, xxxxxxxx wrote:

        Hi,

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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 !

          1 Reply Last reply Reply Quote 0
          • First post
            Last post