oForm=Createobject('TestForm') oForm.AddObject('myContainer','Container') With oForm.MyContainer .Left = 20 .Top = 30 .Height = 300 .Width = 300 .AddObject('oContainer','TestContainer') Endwith oForm.SetAll('Visible', .T.) oForm.Show Read Events Define Class TestContainer As Container Width = 100 Height = 100 Top =100 Left =100 BackColor=Rgb(255,0,0) Add Object oBox As TestBox X1=0 X2=0 Y1=0 Y2=0 Procedure Init Local nTreshHold nTreshHold = 2 With This .Y1 = Objtoclient(This, 1) + nTreshHold .X1 = Objtoclient(This, 2) + nTreshHold .Y2 = Objtoclient(This, 1) + .Height - nTreshHold .X2 = Objtoclient(This, 2) + .Width - nTreshHold Endwith Endproc Procedure MouseLeave Lparameters nButton, nShift, nXCoord, nYCoord With This If !Between(nXCoord, .X1,.X2) Or ; !Between(nYCoord, .Y1,.Y2) Wait Window This.Name Timeout 1 Endif Endwith Endproc Enddefine Define Class TestBox As Shape Width=50 Height=50 Top=25 Left=25 BackColor=Rgb(0,255,0) Enddefine Define Class TestForm As Form AutoCenter=.T. Width=500 Height=500 Scalemode=3 && Default Procedure Unload Clear Events Endproc EnddefinePS: Outer host container is added only to show why objtoclient.
>oForm=CREATEOBJECT('TestForm') >oForm.ADDOBJECT('oContainer','TestContainer') >oForm.SHOW >READ EVENTS > >DEFINE CLASS TestContainer AS CONTAINER > ADD OBJECT oBox AS TestBox > WIDTH=100 > HEIGHT=100 > TOP=100 > LEFT=100 > BACKCOLOR=RGB(255,0,0) > VISIBLE=.T. > PROCEDURE MOUSELEAVE > LPARAMETERS nButton, nShift, nXCoord, nYCoord > =MESSAGEBOX(THIS.NAME) > ENDPROC >ENDDEFINE > >DEFINE CLASS TestBox AS SHAPE > WIDTH=50 > HEIGHT=50 > TOP=25 > LEFT=25 > BACKCOLOR=RGB(0,255,0) >ENDDEFINE > >DEFINE CLASS TestForm AS FORM > AUTOCENTER=.T. > WIDTH=300 > HEIGHT=300 > PROCEDURE UNLOAD > CLEAR EVENTS > ENDPROC >ENDDEFINE > >>