Hello Mr. Radde,
I have now installed VPEView on my test tablet (an old Acer Iconia Tab W500), and tried to use gestures.
It is possibile to zoom in and out with the 2-finger gesture, but it is not possible to scroll in the document.
Scrolling the document with a gesture is very easy to test with the mouse: move the mouse pointer with pressed left key over the document.
I have implemented the scrolling gesture in the listview with the following Visual Objects code (should be understandable also for a C programmer):
- Code: Select all
class TouchListView inherit EnhListView
protect _nLastMouseX as int
protect _nLastMouseY as int
method Dispatch( oEvent ) class TouchListView
local nReturn as int
local oLocalEvent as Event
local nX as int
local nY as int
local nMovementX as int
local nMovementY as int
oLocalEvent := oEvent
nReturn := super:Dispatch( oLocalEvent )
if oLocalEvent:Message == WM_MOUSEMOVE
// From MSDN: Do not use the LOWORD or HIWORD macros to extract the x- and y- coordinates of the cursor position because these macros return incorrect results on systems
// with multiple monitors. Systems with multiple monitors can have negative x- and y- coordinates, and LOWORD and HIWORD treat the coordinates as unsigned quantities.
nX := LoInt( oLocalEvent:lParam )
nY := HiInt( oLocalEvent:lParam )
if _And( oLocalEvent:wParam, MK_LBUTTON ) == MK_LBUTTON
if _nLastMouseX != 0 .and. _nLastMouseY != 0
nMovementX := _nLastMouseX - nX
nMovementY := _nLastMouseY - nY
ListView_Scroll( self:Handle(), nMovementX, nMovementY )
endif
_nLastMouseX := nX
_nLastMouseY := nY
else
_nLastMouseX := 0
_nLastMouseY := 0
endif
endif
return nReturn
static function HiInt( nInt as int ) as int pascal
local nReturn as int
nReturn:= ( nInt >> 16 )
return nReturn
static function LoInt( nInt as int ) as int pascal
local nReturn as int
nReturn := _And( nInt, 0xFFFF )
return nReturn
A little explanation: protect variables are class variables not visible outside the object itself.
During mouse move, it is checked if the left mouse key is pressed. When it is not pressed, the saved coordinates in the control are reset. If the mouse key is pressed, and the saved coordinates have a value other than 0, then the control is moved by the difference between the last and the actual position (both horizontally and vertically), then the actual position is saved.
Thank you very much!
Wolfgang