User Tools

Site Tools


takewindowevent_a_virtual_to_process_non_field_events_reportmanager_.htm
Navigation:  ABC Library Reference > ReportManager Class > ReportManager Methods >====== TakeWindowEvent (a virtual to process non-field events:ReportManager) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

TakeWindowEvent, VIRTUAL, PROC

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

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, Next, TimeSlice, TakeRecord, WindowManager.TakeEvent, WindowManager.TakeWindowEvent

takewindowevent_a_virtual_to_process_non_field_events_reportmanager_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1