>loForm = NEWOBJECT('myForm') >loForm.Show(1) > >define class myForm AS Form > > Height = 401 > Width = 759 > DoCreate = .T. > BorderStyle = 3 > Name = "myForm" > > add object ctrParentContainer AS ParentContainer WITH ; > Top = 48, ; > Left = 25, ; > Width = 361, ; > Height = 110, ; > Name = "ctrParentContainer" > >enddefine > >define class ParentContainer as Container > > add object MovableContainer1 as MovableContainer with ; > Top = 16, ; > Left = 23, ; > Width = 100, ; > Height = 47, ; > Name = "MovableContainer1", ; > RestrictHorizontal = .f., ; > RestrictVertical = .f. > > add object MovableContainer2 as MovableContainer with ; > Top = 70, ; > Left = 23, ; > Width = 100, ; > Height = 47, ; > Name = "MovableContainer2", ; > RestrictHorizontal = .t., ; > RestrictVertical = .f. > > add object MovableContainer3 as MovableContainer with ; > Top = 16, ; > Left = 120, ; > Width = 100, ; > Height = 47, ; > Name = "MovableContainer3", ; > RestrictHorizontal = .f., ; > RestrictVertical = .t. > > add object MovableContainer4 as MovableContainer with ; > Top = 70, ; > Left = 120, ; > Width = 100, ; > Height = 47, ; > Name = "MovableContainer4", ; > RestrictHorizontal = .t., ; > RestrictVertical = .t. >enddefine > > >define class MovableContainer as Container > Moving = .f. > Starting = null > RestrictHorizontal = .f. > RestrictVertical = .f. > > add object lblCaption as Label with ; > Top = 1, ; > Left = 1, ; > FontName = 'ArialNarrow', ; > FontSize = 8, ; > Enabled = .f. > > PROCEDURE Init > this.lblCaption.Caption = 'Restrict X: ' + Transform(this.RestrictHorizontal) + ' Y: ' + Transform(this.RestrictVertical) > this.Starting = Createobject('Empty') > Addproperty(this.Starting, 'X', null) > Addproperty(this.Starting, 'Y', null) > Addproperty(this.Starting, 'Left', null) > Addproperty(this.Starting, 'Top', null) > ENDPROC > > PROCEDURE MouseDown > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > if nButton = 1 > this.Moving = .t. > this.Starting.Left = this.Left > this.Starting.Top = this.Top > this.Starting.X = nXCoord > this.Starting.Y = nYCoord > endif > ENDPROC > > > PROCEDURE MouseUp > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > if nButton = 1 > this.Moving = .f. > endif > ENDPROC > > > PROCEDURE MouseMove > LPARAMETERS nButton, nShift, nXCoord, nYCoord > > if this.Moving > this.Left = this.Starting.Left + Iif(this.RestrictHorizontal, 0, (nXCoord - this.Starting.X)) > this.Top = this.Starting.Top + Iif(this.RestrictVertical, 0, (nYCoord - this.Starting.Y)) > endif > ENDPROC >enddefine > > >