BreakManagerClass - Conceptual Example

Top  Previous  Next

The following example shows a sequence of statements to declare, and instantiate a BreakManager object.

 

  MEMBER('people.clw')       ! This is a MEMBER module

 

  INCLUDE('ABBREAK.INC'),ONCE

  INCLUDE('ABBROWSE.INC'),ONCE

  INCLUDE('ABREPORT.INC'),ONCE

 

 MAP

  INCLUDE('PEOPL005.INC'),ONCE        !Local module procedure declarations

 END

 

PrintPEO:KeyLastName PROCEDURE         ! Generated from procedure template - Report

 

Progress:Thermometer BYTE

FilesOpened          BYTE

TestCount            LONG

Process:View VIEW(people)

             PROJECT(PEO:FirstName)

             PROJECT(PEO:Gender)

             PROJECT(PEO:Id)

             PROJECT(PEO:LastName)

            END

LocMyFocusControlExT SHORT(0)          !Used by the ENTER Instead of Tab template

LocEnableEnterByTab  BYTE(1)           !Used by the ENTER Instead of Tab template

ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE

               PROGRESS,USE(Progress:Thermometer),AT(15,15,111,12),RANGE(0,100)

               STRING(''),AT(0,3,141,10),USE(?Progress:UserString),CENTER

               STRING(''),AT(0,30,141,10),USE(?Progress:PctText),CENTER

               BUTTON('Cancel'),AT(45,42,50,15),USE(?Progress:Cancel)

              END

 

report REPORT,AT(1000,1540,6000,7458),PRE(RPT),FONT('Arial',10,,),THOUS

       HEADER,AT(1000,1000,6000,542)

        STRING('People by Last Name’),AT(0,20,6000,220),CENTER,FONT(,,,FONT:bold)

        BOX,AT(0,260,6000,280),COLOR(COLOR:Black),FILL(COLOR:Silver)

        LINE,AT(1500,260,0,280),COLOR(COLOR:Black)

        LINE,AT(3000,260,0,280),COLOR(COLOR:Black)

        LINE,AT(4500,260,0,280),COLOR(COLOR:Black)

        STRING('Id'),AT(50,310,1400,170),TRN

        STRING('First Name'),AT(1550,310,1400,170),TRN

        STRING('Last Name'),AT(3050,310,1400,170),TRN

        STRING('Gender'),AT(4550,310,1400,170),TRN

       END

detail   DETAIL,AT(,,6000,281),USE(?unnamed)

         LINE,AT(1500,0,0,280),COLOR(COLOR:Black)

         LINE,AT(3000,0,0,280),COLOR(COLOR:Black)

         LINE,AT(4500,0,0,280),COLOR(COLOR:Black)

         STRING(@S10),AT(50,50,1400,170),USE(PEO:Id),RIGHT(1)

         STRING(@S30),AT(1550,50,1400,170),USE(PEO:FirstName)

         STRING(@S30),AT(3050,50,1400,170),USE(PEO:LastName)

         STRING(@S1),AT(4552,52,240,167),USE(PEO:Gender)

         STRING(@n_4),AT(5208,42),USE(TestCount),RIGHT(1)

         LINE,AT(50,280,5900,0),COLOR(COLOR:Black)

        END

        FOOTER,AT(1000,9000,6000,219)

 STRING(@pPage <<<#p),AT(5250,30,700,135),PAGENO,USE(?PageCount),FONT('Arial',8,,FONT:regular)

        END

       END

ThisWindow     CLASS(ReportManager)

Init            PROCEDURE(),BYTE,PROC,DERIVED ! Method added to host embed code

Kill            PROCEDURE(),BYTE,PROC,DERIVED !Method added to host embed code

OpenReport      PROCEDURE(),BYTE,PROC,DERIVED ! Method added to host embed code

SetAlerts       PROCEDURE(),DERIVED           ! Method added to host embed code

TakeWindowEvent PROCEDURE(),BYTE,PROC,DERIVED ! Method added to host embed code

              END

 

ThisReport CLASS(ProcessClass)                ! Process Manager

TakeRecord  PROCEDURE(),BYTE,PROC,DERIVED     ! Method added to host embed code

          END

 

ProgressMgr StepStringClass          ! Progress Manager

Previewer   PrintPreviewClass        ! Print Previewer

BreakMgr    BreakManagerClass        ! Break Manager

 

 CODE

 GlobalResponse = ThisWindow.Run()  ! Opens the window and starts an Accept Loop

 

!---------------------------------------------------------------------------

DefineListboxStyle ROUTINE

!|

!| This routine create all the styles to be shared in this window

!| It's called after the window open

!|

!---------------------------------------------------------------------------

 

ThisWindow.Init PROCEDURE

 

ReturnValue          BYTE,AUTO

 

 CODE

 GlobalErrors.SetProcedureName('PrintPEO:KeyLastName')

 SELF.Request = GlobalRequest        ! Store the incoming request

 ReturnValue = PARENT.Init()

 IF ReturnValue THEN RETURN ReturnValue.

 SELF.FirstField = ?Progress:Thermometer

 SELF.VCRRequest &= VCRRequest

 SELF.Errors &= GlobalErrors       ! Set this windows ErrorManager to the global ErrorManager

 CLEAR(GlobalRequest)              ! Clear GlobalRequest after storing locally

 CLEAR(GlobalResponse)

 SELF.AddItem(Translator)          ! Run-time translation enabled so get the global translator

 Relate:people.Open

 ! File people used by this procedure, so make sure it's RelationManager is open

 SELF.FilesOpened = True

 BreakMgr.Init()                   !Initialize the BreakManager object

 BreakMgr.AddBreak()               !A break exists

 BreakMgr.AddLevel()               !People Count is the name of the brteak

 BreakMgr.AddResetField(PEO:Gender)!resets when gender changes

 BreakMgr.AddTotal(TestCount,1)    !Performs a count when break occurs

 SELF.AddItem(BreakMgr)

 OPEN(ProgressWindow)              ! Open window