BrowseEIPManagerClass - Conceptual Example  

Top  Previous  Next

The following example shows a sequence of statements to declare, and instantiate a BrowseEIPManager object. The example page-loads a LIST of actions and associated priorities, then edits the list items via edit-in-place. Note that the BrowseClass object declares a BrowseEIPManager which is a refrence to the EIPManager as declared in ABBrowse.INC.

  PROGRAM

 

_ABCDllMode_  EQUATE(0)

_ABCLinkMode_ EQUATE(1)

 

  INCLUDE('ABBROWSE.INC'),ONCE

  INCLUDE('ABEIP.INC'),ONCE

  INCLUDE('ABWINDOW.INC'),ONCE

  MAP

  END

 

Actions              FILE,DRIVER('TOPSPEED'),PRE(ACT),CREATE,BINDABLE,THREAD

KeyAction                KEY(ACT:Action),NOCASE,OPT

Record                   RECORD,PRE()

Action                      STRING(20)

Priority                    DECIMAL(2)

Completed                   DECIMAL(1)

                        END

                    END

 

Access:Actions       &FileManager

Relate:Actions       &RelationManager

GlobalErrors         ErrorClass

GlobalRequest        BYTE(0),THREAD

ActionsView   VIEW(Actions)

             END

 

Queue:Browse  QUEUE

ACT:Action     LIKE(ACT:Action)

ACT:Priority   LIKE(ACT:Priority)

ViewPosition   STRING(1024)

             END

Window WINDOW('Browse Records'),AT(0,0,247,140),SYSTEM,GRAY

        LIST,AT(5,5,235,100),USE(?List),IMM,HVSCROLL,MSG('Browsing Records'),|

        FORMAT('80L~Action~@S20@8R~Priority~L@N2@'),FROM(Queue:Browse)

        BUTTON('&Insert'),AT(5,110,40,12),USE(?Insert),KEY(InsertKey)

        BUTTON('&Change'),AT(50,110,40,12),USE(?Change),KEY(CtrlEnter),DEFAULT

        BUTTON('&Delete'),AT(95,110,40,12),USE(?Delete),KEY(DeleteKey)

      END

 

ThisWindow  CLASS(WindowManager)

Init         PROCEDURE(),BYTE,PROC,DERIVED

Kill         PROCEDURE(),BYTE,PROC,DERIVED

           END

 

BRW1 CLASS(BrowseClass)

Q    &Queue:Browse

Init PROCEDURE(SIGNED ListBox,*STRING Posit,VIEW V,QUEUE Q,RelationManager RM,WindowManager WM)

    END

 

BRW1::EIPManager  BrowseEIPManager  ! Browse EIP Manager for Browse using ?List

 

 CODE

 GlobalErrors.Init

 Relate:Actions.Init

 GlobalResponse = ThisWindow.Run()

 Relate:Actions.Kill

 GlobalErrors.Kill

 

 

ThisWindow.Init PROCEDURE

 

ReturnValue          BYTE,AUTO

 CODE

 SELF.Request = GlobalRequest

 ReturnValue =PARENT.Init()

 IF ReturnValue THEN RETURN ReturnValue.

 SELF.FirstField = ?List

 SELF.VCRRequest &= VCRRequest

 SELF.Errors &= GlobalErrors

 SELF.AddItem(Toolbar)

 CLEAR(GlobalRequest)

 CLEAR(GlobalResponse)

 Relate:Actions.Open

 FilesOpened = True

 BRW1.Init(?List,Queue:Browse.ViewPosition,BRW1::View:Browse,Queue:Browse,Relate:Actions,SELF)

 OPEN(Window)

 SELF.Opened=True

 BRW1.Q &= Queue:Browse

 BRW1.AddSortOrder(,ACT:KeyAction)

 BRW1.AddLocator(BRW1::Sort0:Locator)

 BRW1::Sort0:Locator.Init(,ACT:Action,1,BRW1)

 BRW1.AddField(ACT:Action,BRW1.Q.ACT:Action)

 BRW1.AddField(ACT:Priority,BRW1.Q.ACT:Priority)

 BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn

 BRW1.InsertControl=?Insert

 BRW1.ChangeControl=?Change

 BRW1.DeleteControl=?Delete

 BRW1.AddToolbarTarget(Toolbar)

 SELF.SetAlerts()

 RETURN ReturnValue

 

 

ThisWindow.Kill PROCEDURE

 

ReturnValue          BYTE,AUTO

 CODE

 ReturnValue =PARENT.Kill()

 IF ReturnValue THEN RETURN ReturnValue.

 IF FilesOpened

   Relate:Actions.Close

 END

 RETURN ReturnValue

 

 

BRW1.Init PROCEDURE|

         (SIGNED ListBox,*STRING Posit,|

          VIEW V,QUEUE Q,RelationManager RM,WindowManager WM)

 

 CODE

 PARENT.Init(ListBox,Posit,V,Q,RM,WM)

 SELF.EIP &= BRW1::EIPManager