Pointer coordinates inside a UserArea [SOLVED]

On 01/04/2015 at 14:39, xxxxxxxx wrote:

I have the following code:

     def Message(self, msg, result) :   
          if msg.GetLong(c4d.BFM_INPUT_CHANNEL)==c4d.BFM_INPUT_MOUSELEFT:   
               # the mouse is being pressed   
               while True:   
                    # dragging the mouse   
                    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:   
                              if not bc.GetBool(c4d.BFM_INPUT_VALUE) : break   
          return gui.GeUserArea.Message(self, msg, result)   

The starting coordinates (stored in i_x1 and i_y1) are calculated correctly.
But the coordinates of the pointer while the mouse button is being pressed (stored in i_x2 and i_y2) are not being calculated correctly. However I'm using the exact same method to calculate both.
If I use Screen2Local instead of Global2Local (in the calculations of the coordinates while the mouse button is being pressed), the i_x2 coordinate is calculated correctly but the i_y2 coordinate has a negative displacement.
Can't they be calculated the same way?
Please, please, please, someone help me.

On 01/04/2015 at 14:43, xxxxxxxx wrote:

Ok, solved it!!! 😄
It was fast.
I just replaced the:

if gui.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSELEFT, bc) :


if self.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSELEFT, bc) :

On 02/04/2015 at 03:24, xxxxxxxx wrote:

You should do this in InputEvent(), not Message()