Article ID: 139626
Article Last Modified on 7/1/2004
* The first line is already there.
* oSource is a reference to the object being dragged.
* nXcoord and nYcoord are the coordinates of the mouse pointer
* within the target form. Their coordinates are taken from the
* position of the tip of the mouse pointer.
LPARAMETERS oSource, nXCoord, nYCoord
oName = oSource.name
* The IF test checks the Container1pict property. It it is true (.T),
* the object already exists and you are moving it, so you can skip
* the addobject procedures. If it is false (.F.), you need to run the
* addobject procedures
IF thisform.container1pict = .T.
* Addobject adds an object of the type specified by oSource.class to
* the container and gives it the name referenced by the oName
* variable.
this.addobject(oName,oSource.class)
oRef=eval('this.'+oName)
oRef.picture = oSource.picture
* nXcoord and nYcoord are absolute form coordinates.
* They need to be recalculated relative to the container.
oRef.top = (nYcoord -(oRef.height/2))- this.top
oRef.left = (nXcoord-(oRef.width/2)) - this.left
* Addobject always sets the visible property to false (.F.).
* This property must be reset when you are ready to display it.
oRef.visible = .t.
* You want only one copy or instance of the object:
thisform.containerx1.removeobject(oName)
oRef.dragmode = 1
thisform.refresh
thisform.container1pict = .f.
thisform.container2pict = .t.
ELSE
* If the object already exists, you are moving it within the
* container nXcoord and nYcoord are recalculated differently and
* the move event is called.
nXcoord = nXcoord - this.left
nYcoord = nYcoord - this.top
oSource.move((nXcoord-oSource.width/2),(nYcoord-oSource.height/2))
oSource.visible = .t.
ENDIF
Containerx1 should read:
IF thisform.container2pict = .T.
Containerx2 should read:
IF thisform.container1pict = .T.
Containerx1 should read:
thisform.containerx2.removeobject(oName)
Containerx2 should read:
thisform.containerx1.removeobject(oName)
Containerx1 should read:
thisform.container1pict = .t.
thisform.container2pict = .f.
Containerx2 should read:
thisform.container1pict = .f.
thisform.container2pict = .t.
Keywords: kbhowto kbcode KB139626