simultaneous button down and mouse movement not working.

Discussion in 'Mac Programming' started by MACaveli7, Nov 4, 2010.

  1. macrumors newbie

    Joined:
    Oct 15, 2010
    #1
    Hi Guys. I'm using GetEventParameter to get the position of the mouse, however whenever I press a button it seems to stop processing the mouse movement.

    I'm am using the function for mouse movement as follows:

    GetEventParameter(Event, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(MousePos), NULL, &MousePos);

    for mouse button presses.

    GetEventParameter(Event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(typeMouseButton), NULL, &uButtonPressed);

    Thanks for your time.
     
  2. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Do you have a good reason to write Carbon code today?
    And what events are you processing? Any dragging events?
     
  3. thread starter macrumors newbie

    Joined:
    Oct 15, 2010
    #3
    The code has been written in carbon, I'm not inclined to change it to cocoa since I'm unfamiliar with objective c, but I am open to ideas.

    I am processing drag events, hence why I have the problem, unless you mean that there is a drag mouse event I have to use to get it to recognise simultaneous mouse movements and button presses.
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    This was my first thought when I looked at your code but I never use Carbon so I can't really be sure.
     
  5. thread starter macrumors newbie

    Joined:
    Oct 15, 2010
    #5
    turns out you were right. There is a kEventMouseDragged event, it uses the same functionality as the mouse move event.

    EventTypeSpec MouseHandlerEventsDrag[] = {kEventClassMouse, kEventMouseDragged};

    InstallApplicationEventHandler(NewEventHandlerUPP(LeapardMouseEventDraggedHandler), 1, &MouseHandlerEventsDrag[0], this, NULL);

    EventTypeSpec MouseHandlerEventsMove[] = {kEventClassMouse, kEventMouseMoved};

    InstallApplicationEventHandler(NewEventHandlerUPP(LeapardMouseEventMovedHandler), 1, &MouseHandlerEventsMove[0], this, NULL);
     

Share This Page