Mouse tracking

From: [at]} <robert.d.campbell{>
Date: Thu, 24 May 2001 09:20:19 +0100 (BST)

In the outline procedure below I try to monitor the status of
the modifier (Ctrl) key while tracking the mouse position
during a 'drag' operation. The intention is to only allow the
drag if the Ctrl key is pressed, and to abort the operation if
it is released.

However I find that modifiers is only updated to reflect the mouse
buttons, not updated to replect the current state of the modifier key.

The commented out WinApi approach also does not work.

Can anyone tell me how to monitor the Ctrl key during a mouse drag?



Thanks


Robert Campbell


(I have only tried this in 1.4 beta.)



PROCEDURE (v : View) HandleCtrlMsg* (frame : Views.Frame;
               VAR msg : Controllers.Message; VAR focus : Views.View);
  VAR
    x, y : INTEGER;
    modifiers : SET;
    ctlFlg, isDown : BOOLEAN;
  BEGIN
    WITH msg : Controllers.TrackMsg DO
      ctlFlg := Controllers.modify IN msg.modifiers;
      IF ctlFlg THEN
        REPEAT
          frame.Input (x, y, modifiers, isDown);
          ctlFlg := Controllers.modify IN modifiers;
(*
          ctlFlg := WinApi.GetKeyState (Api.VK_CONTROL) < 0;
*)
          ... Show status of x, y ...

        UNTIL ~(isDown & ctlFlg);
        IF ctlFlg THEN ... Take action with x, y ... END
      END
    END
  END HandleCtrlMsg;




--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
Received on Thu May 24 2001 - 08:20:19 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:43 UTC