DEFINE CLASS MyRL AS ReportListener nStretchRect = 0 && Recno of our stretchy rectangle ... FUNCTION BeforeReport LOCAL lcGroupExpr ** Find the stretchy rectangle SET DATASESSION TO (This.FRXDataSession) SELECT frx ** Find the Group expression lcGroupExpr = "" LOCATE FOR objtype=9 and objcode=4 IF FOUND() SKIP -1 IF objcode = 3 lcGroupExpr = expr ENDIF ENDIF ** Find the dummy rectangle LOCATE FOR "*:stretchy" $ comment IF FOUND() This.nStretchRect = RECNO() ENDIF SET DATASESSION TO (This.CurrentDataSession) ** Create a temp table to track our 3rd from the bottom ** record for each group lnSelect = SELECT() CREATE CURSOR curDetailBreak (recno i) INDEX ON recno TAG recno SELECT (lnSelect) *! ToDo: FInish this code ** Scan through the cursor looking for group ** changes and insert the 3rd from the bottom RECNO() ** of each group into curDetailBreak leLastGroupValue = EVALUATE(lcGroupExpr) lnRecno = RECNO() SCAN leThisGroupValue = EVALUATE(lcGroupExpr) IF leLastGroupValue != leThisGroupValue ** Save the current record position lnLastRecNo = RECNO() ** go back 2 records SKIP -1 SKIP -1 ** store the recno in the temp cursor INSERT INTO curDetailBreak (recno) VALUES (RECNO()) LOCATE RECORD (lnLastRecNo) ENDIF leLastGroupValue = EVALUATE(lcGroupExpr) ENDSCAN SKIP -1 SKIP -1 INSERT INTO curDetailBreak (recno) VALUES (RECNO()) LOCATE RECORD (lnRecNo) ENDFUNC FUNCTION AfterReport ** Close the temp table USE IN SELECT("curDetailBreak") ENDFUNC FUNCTION AdjustObjectSize(nFRXRecNo, oProp) IF nFRXRecNo = This.nStretchRect AND SEEK(RECNO(),"curDetailBreak") ** We are on the stretch rectangle and the 3rd from ** the bottom record... ** Force a new page by making the rectangle equal to ** the max size oProp.Height = oProp.MaxHeightAvailable oProp.Reload = .T. ENDIF ENDFUNC ENDDEFINE