>Is there a way to know if any object is placed at a certain location ?
>For example if I want to place an object ( a shape) at a certain location,
>i'd like to know if another object occupies the place where I want to put
>it.....
>Comments and appreciations about my english are not welcome :-)
>
>Alessio
Here is a collision method used to test if another object touch the current one on the same container.
This method test for an object of the same class, but it's easy to change it to test for any class.
You can call it after a move (in mouseup) to test for collision.
x1=this.Left
x2=this.Left+this.Width
y1=this.Top
y2=this.Top+this.Height
FOR i=1 TO this.parent.ControlCount
lTouch=.F.
oPan=this.parent.Controls(i)
IF oPan.Class=this.Class AND oPan <> this
lTouch=.T.
DO CASE
CASE oPan.Top>=y2
lTouch=.F.
CASE oPan.Left>=x2
lTouch=.F.
CASE oPan.Top+oPan.Height<=y1
lTouch=.F.
CASE oPan.Left+oPan.Width<=x1
lTouch=.F.
ENDCASE
ENDIF
oPan=.NULL.
IF lTouch
RETURN .T.
ENDIF
ENDFOR
RETURN .F.
HTH :)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca