#Define RDW_UPDATENOW 0x0100 oform = Newobject("testmove") oform.Show Read Events Define Class testmove As Form BorderStyle = 2 Caption = "testmove" AlwaysOnTop = .T. BackColor = Rgb(255,255,255) Name = "testmove" scalemode = 3 oObj = NULL width = 900 height = 700 Procedure MouseDown Lparameters nButton, nShift, nXCoord, nYCoord this.moveobject( nXCoord, nYCoord ) return function init Declare INTEGER RedrawWindow in User32.dll INTEGER hWnd, INTEGER lprcUpdate, INTEGER hrgnUpdate, INTEGER flags lcNewObjName = 'theObject' this.newobject( m.lcNewObjName, 'label' ) this.oObj = this.&lcNewObjName this.&lcNewObjName..visible = .t. addproperty(this.oObj, 'fullleft', this.oObj.left) addproperty(this.OObj, 'fulltop', this.oObj.top) return function queryunload clear dlls Sleep clear events return function keypress LPARAMETERS nKeyCode, nShiftAltCtrl if inlist( nKeyCode, 27, 113, 32 ) clear events endif return function moveobject lparameter tnToLeft, tnToTop local lnStep, ln, lnT, lnL with this lnStep = 30 lnT = ( m.tnToTop - .oObj.fulltop ) / m.lnStep lnL = ( m.tnToLeft - .oObj.fullleft ) / m.lnStep with .oObj for ln = 1 to m.lnStep * .caption = transform( m.ln ) + ': ' + TRANSFORM(.fulltop, '9999.99') + ', ' + TRANSFORM(.fullleft, '9999.99') .fulltop = .fulltop + m.lnT .fullleft = .fullleft + m.lnL * .top = .fulltop && this will round up .top .left = .fullleft && this will round up .left RedrawWindow(THISFORM.HWnd, 0, 0, RDW_UPDATENOW) Pause(1 / m.lnStep) next .refresh() endwith endwith enddefine FUNCTION Pause( tnSeconds ) DECLARE Sleep in WIN32API integer Sleep( max( 0, tnSeconds ) * 1000 ) RETURN>Hi all,
oform = Newobject("testmove") >oform.Show >Read Events > >Define Class testmove As Form > BorderStyle = 2 > Caption = "testmove" > AlwaysOnTop = .T. > BackColor = Rgb(255,255,255) > Name = "testmove" > scalemode = 3 > oObj = NULL > width = 900 > height = 700 > >Procedure MouseDown > Lparameters nButton, nShift, nXCoord, nYCoord > this.moveobject( nXCoord, nYCoord ) > return > >function init > lcNewObjName = 'theObject' > this.newobject( m.lcNewObjName, 'label' ) > this.oObj = this.&lcNewObjName > this.&lcNewObjName..visible = .t. > return > >function queryunload > clear dlls Sleep > clear events > return > >function keypress > LPARAMETERS nKeyCode, nShiftAltCtrl > if inlist( nKeyCode, 27, 113, 32 ) > clear events > endif > return > >function moveobject > > lparameter tnToLeft, tnToTop > > local lnStep, ln, lnT, lnL > > with this > > lnStep = 30 > lnT = ( m.tnToTop - .oObj.top ) / m.lnStep > lnL = ( m.tnToLeft - .oObj.left ) / m.lnStep > > with .oObj > > for ln = 1 to m.lnStep > * > .caption = transform( m.ln ) > .top = .top + m.lnT > .left = .left + m.lnL > * > pause( 2 / m.lnStep ) > next > > endwith > endwith > >enddefine > >FUNCTION Pause( tnSeconds ) > DECLARE Sleep in WIN32API integer > Sleep( max( 0, tnSeconds ) * 1000 ) > RETURN