Neil Toulouse
Programmer
Hi guys!
I think I have been staring at this for too long now so some fresh eyes would be appreciated!
This is a dead simple form, 2 buttons where one is 'draggable' (ADD).
The problem is I get a Syntax error on the .XOffSet = nXCoord – THIS.LEFT in the cmdAddTxt.MouseMove event. This is VFP8, and the code is mostly from the help file on drag & drop!
TIA!
Neil
I like work. It fascinates me. I can sit and look at it for hours...
I think I have been staring at this for too long now so some fresh eyes would be appreciated!
This is a dead simple form, 2 buttons where one is 'draggable' (ADD).
Code:
*** Create instance of form
oCustomForm = CREATEOBJECT('Custom_Form')
oCustomForm.SHOW()
***
**************
* CLASS CODE *
**************
DEFINE CLASS Custom_form AS FORM
TOP = 7
LEFT = 10
HEIGHT = 459
WIDTH = 552
DOCREATE = .T.
BORDERSTYLE = 1
CAPTION = "Custom Fields"
CONTROLBOX = .F.
NAME = "FRMCUSTOM"
WINDOWTYPE = 1
XOffSet = 0
YOffSet = 0
ADD OBJECT cmdexit AS COMMANDBUTTON WITH ;
TOP = 418, ;
LEFT = 451, ;
HEIGHT = 27, ;
WIDTH = 84, ;
CAPTION = "Exit", ;
TABINDEX = 15, ;
NAME = "cmdExit"
ADD OBJECT cmdAddTxt AS COMMANDBUTTON WITH ;
TOP = 385, ;
LEFT = 451, ;
HEIGHT = 27, ;
WIDTH = 84, ;
CAPTION = "Add", ;
TABINDEX = 15, ;
NAME = "cmdAddTxt", ;
VISIBLE = .T.
PROCEDURE cmdexit.CLICK
THISFORM.RELEASE()
ENDPROC
PROCEDURE cmdAddTxt.MOUSEMOVE
LPARAMETERS nButton, nShift, nXCoord, nYCoord
LOCAL lnResult
IF nButton = 1
WITH THISFORM
.XOffSet = nXCoord – THIS.LEFT
.YOffSet = nYCoord - THIS.TOP
ENDWITH
THIS.DRAG
ENDIF
ENDPROC
PROCEDURE cmdAddTxt.DRAGDROP
LPARAMETERS oSource, nXCoord, nYCoord
THIS.PARENT.DRAGDROP(oSource, nXCoord, nYCoord)
ENDPROC
PROCEDURE DRAGDROP
LPARAMETERS oSource, nXCoord, nYCoord
oSource.LEFT = nXCoord - THISFORM.XOffSet
oSource.TOP = nYCoord - THISFORM.YOffSet
ENDPROC
ENDDEFINE
**************************************************
The problem is I get a Syntax error on the .XOffSet = nXCoord – THIS.LEFT in the cmdAddTxt.MouseMove event. This is VFP8, and the code is mostly from the help file on drag & drop!
TIA!
Neil
I like work. It fascinates me. I can sit and look at it for hours...