Dimension arrObjects[20,2] For ix=1 to alen(arrObjects,1) arrObjects[ix,1] = 'Label'+padl(ix,3,'0') Endfor oForm = createobject('myForm', @arrObjects, 400, 500) Dimension arrObjects[120,2] For ix=1 to alen(arrObjects,1) arrObjects[ix,1] = 'Label'+padl(ix,3,'0') Endfor oForm2 = createobject('myForm', @arrObjects, 300, 450) With oForm .Caption = 'New objects would appear on this same form' .Show oForm2.Left = .Left + 100 && Cascade oForm2.Top = .Top + 100 oForm2.Show && Show second also Messagebox('Will modify contents of first form...') Dimension .SourceObjects[120,2] For ix=1 to alen(.SourceObjects,1) .SourceObjects[ix,1] = 'Label'+padl(ix,3,'0') Endfor ._ClearForm ._BuildForm .Setall('Visible',.T.) Endwith Read events Define class myForm as Form ObjWdth = 0 ObjHgt = 0 ColGap = 20 RowGap = 5 ColPerRow = 0 RowPerPage = 0 ObjPerPage = 0 FrmHgt = 0 PgfPageHeight = 0 Dimension SourceObjects[1] Procedure Init Lparameters taObjects, tnHeight, tnWidth With this Acopy(taObjects, .SourceObjects) .Height = tnHeight .Width = tnWidth ._BuildForm() .Setall('Visible',.t.) Endwith Endproc Procedure _ClearForm Local lnMembers,ix lnMembers=amembers(arrMembers,this,2) For ix=1 to lnMembers This.RemoveObject(arrMembers[ix]) Endfor Endproc Procedure _BuildForm Local oTempLbl, oTempTxt, oTempPgf, lnPages, ix With this oTempLbl = createobject('myLabel') oTempTxt = createobject('myTextBox') oTempPgf = createobject('myPageFrame',.Height,.Width,1) .ObjWdth = oTempLbl.Width + oTempTxt.Width + 5 .ObjHgt = oTempTxt.Height .PgfPageHeight = oTempPgf.PageHeight Release oTempLbl, oTempTxt, oTempPgf .ColPerRow = floor((.Width - .ColGap) / .ObjWdth) && Max cols on a row .RowPerPage = floor((.Height - .RowGap) / .ObjHgt) && Max rows .ObjPerPage = .ColPerRow * .RowPerPage If alen(.SourceObjects,1) > .ObjPerPage && Need a pageframe .FrmHgt = .PgfPageHeight .RowPerPage = floor((.PgfPageHeight - .RowGap) / .ObjHgt) && Max rows .ObjPerPage = .ColPerRow * .RowPerPage lnPages = ceiling(alen(.SourceObjects,1)/.ObjPerPage) .AddObject('myPageFrame','myPageFrame',.Height,.Width,lnPages) For ix=1 to lnPages ._Addobjects(.myPageFrame.Pages(ix), ix) Endfor Else .FrmHgt = .Height ._Addobjects(this, 1) Endif Endwith Endproc Procedure _Addobjects Lparameters toTarget, tnGroup Local lnStart, lnStop, ix With this lnStart = (tnGroup - 1) * .ObjPerPage + 1 lnStop = min(tnGroup * .ObjPerPage, alen(.SourceObjects,1)) For ix=lnStart to lnStop lnPosOnCol = (ix-lnStart) % .RowPerPage + 1 lnPosOnRow = floor((ix-lnStart) / .RowPerPage) toTarget.AddObject('lbl'+padl(ix,4,'0'),'myLabel',.SourceObjects[ix,1]) toTarget.AddObject('txt'+padl(ix,4,'0'),'myTextBox',.SourceObjects[ix,2]) With eval('toTarget.lbl'+padl(ix,4,'0')) .Left = lnPosOnRow * (thisform.ObjWdth + thisform.ColGap) .Top = (lnPosOnCol-1) * (thisform.RowGap + .Height) lnTxtLeft = .Left + .Width + 5 lnTxtTop = .Top Endwith With eval('toTarget.txt'+padl(ix,4,'0')) .Left = lnTxtLeft .Top = lnTxtTop Endwith Endfor Endwith Endproc Procedure queryunload Clear events Endproc Enddefine Define class myPageFrame as PageFrame Procedure Init Lparameters tnHeight, tnWidth, tnPageCount With this .Height = tnHeight .Width = tnWidth .PageCount = tnPageCount Endwith Endproc Enddefine Define class myLabel as Label FontBold = .T. FontItalic = .T. BackStyle = 0 Procedure init Lparameters tcCaption If !empty(tcCaption) This.Caption = tcCaption Endif Endproc Enddefine Define class myTextBox as Textbox Procedure init Lparameters tcControlSource If !empty(tcControlSource) This.ControlSource = tcControlSource Endif Endproc EnddefineCetin