| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > ReportManager Class > ReportManager Methods >====== TakeWindowEvent (a virtual to process non-field events:ReportManager) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[takerecord process each record .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[rulemanager.htm|{{btn_next_n.gif|Next page}}]] | | || **TakeWindowEvent, VIRTUAL, PROC** {{blk2blue.jpg|blk2blue.jpg}} The **TakeWindowEvent **method processes all non-field events for the progress window and returns a value indicating whether window ACCEPT loop processing is complete and should stop. TakeWindowEvent returns Level:Benign to indicate processing of this event should continue normally; it returns Level:Notify to indicate processing is completed for this event and the ACCEPT loop should CYCLE; it returns Level:Fatal to indicate the event could not be processed and the ACCEPT loop should BREAK. **Member of: [[reportmanager methods.htm|ReportManager]]** **Implementation:** The TakeEvent method calls the TakeWindowEvent method. The TakeWindowEvent method processes EVENT:Timer events for the report. The TakeWindowEvent method either calls OpenReport (if DeferOpenReport is True) or begins processing a "cycle" of report records. Each timer event begins a "cycle" of report record processing which ends about TimeSlice later. TakeWindowEvent calls the TakeRecord method (which in turn calls the Next method) for each record within a processing cycle. TakeWindowEvent adjusts the number of records processed per cycle to fill the TimeSlice and optimize sharing of machine resources. Finally, TakeWindowEvent calls the WindowManager.TakeWindowEvent method to handle any other non-field events. **Return Data Type:     **BYTE **Example:** | **ReportManager.TakeWindowEvent PROCEDURE** | | **StartOfCycle LONG,AUTO** | | **StartTime    LONG,AUTO** | | **TimeTaken    LONG,AUTO** | | **RVal         BYTE(Level:Benign)** | | **  CODE** | | **    IF EVENT() = EVENT:Timer** | | **      IF SELF.DeferOpenReport** | | **        SELF.OpenReport()** | | **        IF NOT SELF.OpenFailed THEN** | | **           IF NOT SELF.Report&=NULL** | | **              IF SELF.Report{PROPPRINT:Extend}=1 THEN** | | **                 SELF.SetStaticControlsAttributes()** | | **              END** | | **           END** | | **        END** | | **      END** | | **      IF SELF.OpenFailed THEN** | | **         IF NOT SELF.KeepVisible** | | **            RETURN Level:Fatal** | | **         ELSE** | | **            RETURN Level:Benign** | | **         END** | | **      END** | | **! Take a timer event. Adjust RecordsPerCycle to get a granularity of around SELF.TimeSlice** | | **      StartOfCycle = SELF.Process.RecordsProcessed** | | **      StartTime = CLOCK()** | | **      IF SELF.DeferWindow AND StartTime-SELF.StartTime > SELF.DeferWindow * 100** | | **        TARGET{PROP:Hide} = 0** | | **        SELF.DeferWindow = 0** | | **      END** | | **      LOOP** | | **        !Set the MRP to SELF.RecordsPerCycle** | | **        IF SELF.UseMRP** | | **           IF SELF.Process.View{PROP:IPRequestCount}=0** | | **              SELF.Process.View{PROP:IPRequestCount}=SELF.RecordsPerCycle** | | **           END** | | **        END** | | **        LOOP WHILE SELF.Process.RecordsProcessed - StartOfCycle <; SELF.RecordsPerCycle** | | **          RVal = SELF.TakeRecord()** | | **          IF RVal THEN RETURN RVal .** | | **        END** | | **        TimeTaken = CLOCK()-StartTime** | | **        IF 5 * TimeTaken <; SELF.TimeSlice * 4       ! Use integer arithmetic for speed** | | **          SELF.RecordsPerCycle += SELF.RecordsPerCycle** | | **        END** | | **      WHILE 2 * TimeTaken <; SELF.TimeSlice** | | **      !** | | **      IF 2 * TimeTaken > SELF.TimeSlice * 3 AND SELF.RecordsPerCycle > 1** | | **        SELF.RecordsPerCycle = SELF.RecordsPerCycle * 0.5** | | **      END** | | **    END** | | **    RETURN PARENT.TakeWindowEvent()** | | | **See Also:**     [[deferopenreport defer open .htm|DeferOpenReport]], [[next get next report record .htm|Next]], [[timeslice report resource usage .htm|TimeSlice]], [[takerecord process each record .htm|TakeRecord]], [[takeevent a virtual to process all events windowmanagerclass .htm|WindowManager.TakeEvent]], [[takewindowevent a virtual to process non field events windowmanager .htm|WindowManager.TakeWindowEvent]]