Touch support in Preview window

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Touch support in Preview window

Postby wriedmann » Fri Sep 06, 2013 4:17 pm

Hello Mr. Radde,

users using Windows 8 tablets are more and more asking touch support also in the print preview, specifically:

- scroll up and down with the finger (can be easily simulated with a "drag" movement on a non-touch device
- zoom in and out using the two-fingers gesture

I know that this could be a lot of work specially for the zooming function, (I could give you the code I use for the finger movement of a ListView - very simple code intercepting WM_MOUSEMOVE), but it becomes very, very important for users.

Thank you very much!

Wolfgang
wriedmann
 
Posts: 25
Joined: Sun Feb 06, 2011 10:11 pm

Re: Touch support in Preview window

Postby IDEAL Software Support » Thu Sep 12, 2013 2:15 pm

After googling a bit, we found out that Windows 7 and higher provide "legacy support" for gestures.

This means that scrolling and zooming are translated into standard mouse messages for windows that don't register for touch support.

So scrolling and zooming with gestures should work in the VPE preview. We have no touch device here, so we can't test it.

If you are using the VPE preview as an embedded window, it is required that you forward the responsible window messages from your application window to the VPE preview window, otherwise it won't work.

Can you test legacy support with the "Welcome Demo" of vpedemo.exe?
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Re: Touch support in Preview window

Postby wriedmann » Thu Sep 12, 2013 3:21 pm

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
wriedmann
 
Posts: 25
Joined: Sun Feb 06, 2011 10:11 pm

Re: Touch support in Preview window

Postby wriedmann » Thu Sep 12, 2013 3:41 pm

Hello Mr. Radde,

an addition: my larger customers are replacing the iPads with Windows tablets, because the iOS devices are very limiting in business use.

At this moments the managers are the major tablet users, and they would like to run their usual Windows software on the touch devices, so I had to add primitive touch support to my software (where scrolling was the most important, and zooming not so important).

Wolfgang
wriedmann
 
Posts: 25
Joined: Sun Feb 06, 2011 10:11 pm

Re: Touch support in Preview window

Postby IDEAL Software Support » Fri Sep 13, 2013 8:24 am

Your code is a hack. It is not using Windows gesture legacy support. To do so, you need to handle WM_HSCROLL and WM_VSCROLL messages.

VPE does handle those messages. We need to check our code, if there is something missing. Maybe we will acquire a used Windows tablet for debugging.

We will post updated information here about this topic, when it is available.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Re: Touch support in Preview window

Postby wriedmann » Thu Sep 19, 2013 12:09 pm

Hello Mr. Radde,

my code may be a hack, but at this moment it works.

I will try to find a better solution.

And if I can give you a recomendation about a used tablet with Windows: try to find the Acer Iconia Tab W500 and install W8 on it - you should find several of these on Ebay on very interesting prices. And W8 upgrade licenses are available at interesting prices too, only after W 8.1 release an upgrade will cost too much.

(an Iconia Tab W500 was also my test device for Windows 8).

An alternative would be a touch monitor on a normal PC, but they cost more than a used tablet.

Wolfgang
wriedmann
 
Posts: 25
Joined: Sun Feb 06, 2011 10:11 pm

Re: Touch support in Preview window

Postby IDEAL Software Support » Fri Sep 20, 2013 11:53 am

We have checked our code. According to the documentation from Microsoft, an application needs to handle the WM_HSCROLL and WM_VSCROLL messages, with the SB_THUMBPOSITION submessage, to enable legacy touch support for panning (ie. scrolling).

VPE is doing that. So the question is, why it does not work on your machine.

Can you please test it again with the "Welcome Demo" of vpedemo.exe, which is shipped with the installation of VPE?

Is it possible that legacy support needs to be enabled for an application explicitly by setting a compatibility switch in Windows?
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Re: Touch support in Preview window

Postby Frigyes » Fri Sep 20, 2013 11:57 pm

Hallo!

can you make that the "Virtual Print Engine Client" class window, allways the first child on the
"Virtual Print Engine Frame" class window.

in this case we can get the handle easier and can change self the windows proc...

Code: Select all
  myhandle = GetWindow( VpeGetWindowHandle (hDoc),GW_CHILD); 
  g_OldVPE = (WNDPROC)SetWindowLong(myhandle, GWL_WNDPROC, (LONG)NewVPEProc);


at the time the client is not the first child, for example if we have the PAGESCROLLER


Regards
Frigyes
Frigyes
 
Posts: 26
Joined: Thu Jun 29, 2006 12:09 pm

Re: Touch support in Preview window

Postby IDEAL Software Support » Tue Sep 24, 2013 2:41 pm

We have no plan to do so. If you really want to do that (what we do not recommend), you can iterate the list of child windows of the "VPE Frame" window, until you find the "VPE Client" window.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 11 guests

cron