Signatures

Post Reply
Randal
Posts: 261
Joined: Mon Oct 24, 2005 8:04 pm

Signatures

Post by Randal »

Antonio,

A while back I asked about capturing signatures on the handheld. You suggested it may be easy to do using mouse events and setpixel(). I put together a little program using FWH to see if I could make it work on the desktop. The problem is when dragging the mouse the pixels set are too far apart unless you move the mouse very slowly. The following is a sample. Should I be doing something different or doing this a different way?

// Capture Signature
#include "FiveWin.ch"

static oWnd, lDown, hDC

function Main()

lDown := .F.

DEFINE WINDOW oWnd FROM 1, 1 TO 30, 50 ;
TITLE OemToAnsi( "Signature Capture with the mouse" ) ;
MENU BuildMenu()

oWnd:bLClicked := { || lDown := .T. }
oWnd:bLButtonUp := { || lDown := .F. }
oWnd:OnMouseMove:= { | obj, x, y, flags| DrawL(y,x) }

hDC := oWnd:GetDC()

ACTIVATE WINDOW oWnd

return 0


STATIC FUNCTION DrawL(y,x)

IF lDown
SetPixel(hDC, y, x, RGB(0,0,0) )
ENDIF

RETURN NIL

function BuildMenu()

local oMenu

MENU oMenu
MENUITEM "&File"
MENU
MENUITEM "&Clear" ACTION oWnd:Refresh()
ENDMENU

MENUITEM "&End" ACTION oWnd:End()

ENDMENU

return oMenu
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

Randal,

You may try to fine tune the mouse speed using SystemParametersInfo() and the SPI_SETMOUSE flag. Also check mouse_event().
regards, saludos

Antonio Linares
www.fivetechsoft.com
Randal
Posts: 261
Joined: Mon Oct 24, 2005 8:04 pm

Post by Randal »

Antonio,

When I slow the mouse speed down to slowest possible it draws the lines better but on the desktop it is very hard to draw with the mouse moving so slow. I don't know what the behaviour would be on the handheld.

Maybe someone could compile the simple sample I posted and see how it works on the handheld?

Thanks,
Randal Ferguson
Post Reply