Get mouse wheel direction [SOLVED]



  • On 30/03/2015 at 17:35, xxxxxxxx wrote:

    I've sifting through the mouse messages with:

    def Message(self, msg, result) :
        for each in msg:
            if each[0] == 1768452963:  
                print 'mouse wheel: ', result
    

    This detects mouse wheel messages fine, but I can't find any data to indicate the direction the mouse wheel is scrolling (turning).

    How do you do that?

    Thanks,

    Chris



  • On 31/03/2015 at 11:47, xxxxxxxx wrote:

    Hi Chris,
    I'm a bit confused about the message ID you are comparing to. Can you give me a hint, where you found that?
    And can you furthermore give me some context you are trying this (GeUserAre, ToolData,...)?



  • On 31/03/2015 at 12:28, xxxxxxxx wrote:

    I found the message ID by staring at endless streams of message data printed to the console.
    It works fine so far.  It ignores all button presses, and only triggers on wheel scrolls, but there is no direction in the 'result' or anywhere else I can find.

    The context is 'gui.GeUserArea'.

    How do you get mouse wheel directions?

    Thanks.



  • On 01/04/2015 at 06:42, xxxxxxxx wrote:

    Hi,

    in a GeUserArea you can use something like this:

        def InputEvent(self, msg) :
            dev = msg[c4d.BFM_INPUT_DEVICE]
            if dev == c4d.BFM_INPUT_MOUSE:
                chn = msg[c4d.BFM_INPUT_CHANNEL]
                if chn == c4d.BFM_INPUT_MOUSEWHEEL:
                    val = msg[c4d.BFM_INPUT_VALUE]
                    if val > 0:
                        print "dir up"
                    else:
                        print "dir down"
            return True
    


  • On 01/04/2015 at 09:55, xxxxxxxx wrote:

    Andreas,
    Now that's what I call support!

    Thanks,

    Chris



  • On 01/04/2015 at 10:08, xxxxxxxx wrote:

    You are welcome 🙂


Log in to reply