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) oForm.Show Read events Dimension arrObjects[120,2] For ix=1 to alen(arrObjects,1) arrObjects[ix,1] = 'Label'+padl(ix,3,'0') Endfor oForm = createobject('myForm', @arrObjects, 300, 450) oForm.Show 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 Local oTempLbl, oTempTxt, oTempPgf, lnPages, ix With this .Height =tnHeight .Width = tnWidth 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 Acopy(taObjects, .SourceObjects) .ColPerRow = floor((.Width - .ColGap) / .ObjWdth) && Max cols on a row .RowPerPage = floor((.Height - .RowGap) / .ObjHgt) && Max rows .ObjPerPage = .ColPerRow * .RowPerPage If alen(taObjects,1) > .ObjPerPage && Need a pageframe .FrmHgt = .PgfPageHeight .RowPerPage = floor((.PgfPageHeight - .RowGap) / .ObjHgt) && Max rows .ObjPerPage = .ColPerRow * .RowPerPage lnPages = ceiling(alen(taObjects,1)/.ObjPerPage) .AddObject('myPageFrame','myPageFrame',.Height,.Width,lnPages) For ix=1 to lnPages ._Addobjects(.myPageFrame.Pages(ix), ix, ; .ObjPerPage, .RowPerPage, @taObjects, .ObjWdth , .ColGap, .RowGap) Endfor Else .FrmHgt = .Height ._Addobjects(this, 1, ; .ObjPerPage, .RowPerPage, @taObjects, .ObjWdth , .ColGap, .RowGap) Endif .Setall('Visible',.t.) Endwith Endproc Procedure _Addobjects Lparameters toTarget, tnGroup, tnObjPerPage, tnRowPerPage, taObjects, tnObjWdth , tnColGap, tnRowGap Local lnStart, lnStop, ix With this lnStart = (tnGroup - 1) * tnObjPerPage + 1 lnStop = min(tnGroup * tnObjPerPage, alen(taObjects,1)) For ix=lnStart to lnStop lnPosOnCol = (ix-lnStart) % tnRowPerPage + 1 lnPosOnRow = floor((ix-lnStart) / tnRowPerPage) toTarget.AddObject('lbl'+padl(ix,4,'0'),'myLabel',taObjects[ix,1]) toTarget.AddObject('txt'+padl(ix,4,'0'),'myTextBox',taObjects[ix,2]) With eval('toTarget.lbl'+padl(ix,4,'0')) .Left = lnPosOnRow * (tnObjWdth + tnColGap) .Top = (lnPosOnCol-1) * (tnRowGap + .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