Mouse down, not mouse drag

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/10/2012 at 08:36, xxxxxxxx wrote:

Hey guys.
Just stumbled upon this: can you determine if the mouse button is pressed but not releasedand execute something while it is pressed?
I'm working on a tool-plugin and can fake it by using mousedrag, but then in fact you have to drag the mouse at least one pixel. I want to give some visual feedback while the button is pressed but the mouse not dragged.
Is this possible?
Thanx
Phil

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2012 at 06:56, xxxxxxxx wrote:

Hi Phil,

Here's how you can determine if a mouse button is pressed, mouse left is tested in this example:

def MouseInput(self, doc, data, bd, win, msg) :
  
    if msg.GetLong(c4d.BFM_INPUT_CHANNEL)==c4d.BFM_INPUT_MOUSELEFT:
        print "Begin Mouse Left Pressed"
  
        while True:
  
            bc = c4d.BaseContainer()
            if gui.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSELEFT, bc) :
                if bc.GetLong(c4d.BFM_INPUT_CHANNEL)==c4d.BFM_INPUT_MOUSELEFT:
                    print "Mouse Left Pressed"
                    if not bc.GetBool(c4d.BFM_INPUT_VALUE) : break
  
        print "End Mouse Left Pressed"
  
    return True

c4d.BFM_INPUT_VALUE tells if a channel is active or not; if it's false the loop is ended.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/10/2012 at 07:34, xxxxxxxx wrote:

Thank you very much,
works exactly how I wanted. I'll try to wrap my head around it 🙂