Inability To Send Messages During Drag Operation Workaround

When performing a drag/drop operation in Revolution you cannot use 'send in time' to trigger handlers. The engine will just queue any messages you send and process them once the drag operation has finished. This can be problematic if you want to perform some operation while the mouse is not being moved (dragMove is sent during mouse movement). This lesson shows one workaround.

Use a Repeat Loop

The only time you can call handlers during a drag operation is during one of the drag events. In order to call a handler while the mouse is not moving you can use a repeat loop in dragMove. The repeat loops until the mouse location is not the same as it was when dragMove was called or the mouse button is released.

on dragMove pMouseH, pMouseV

   

## Perform some operation until the mouse moves again

repeat until (the mouseloc is not pMouseH,pMouseV) or (mouse(1) is "up" and mouse(3) is "up")

AutoScrollTheField

end repeat

end dragMove

Note: I check mouse(1) and mouse(3) as those are two buttons that could start a drag operation.

Uses

This technique can be useful in situations where you want to automatically scroll the group or field that the cursor is over during a drag operation. For example, if the user rests the mouse near the bottom or top of a group then it is common for the group to scroll down or up so the user can drop the item elsewhere in the list.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.