EditCheckClass Conceptual Example

Top  Previous  Next

The following example shows a sequence of statements to declare, instantiate, initialize, use, and terminate an EditCheckClass object and a related BrowseClass object. The example page-loads a LIST of fieldnames and associated control attributes (such as color, icon, etc.), then edits the "Hide" items with an EditCheckClass object. Note that the BrowseClass object calls the "registered" EditCheckClass object's methods as needed.

  PROGRAM

_ABCDllMode_  EQUATE(0)

_ABCLinkMode_ EQUATE(1)

  INCLUDE('ABWINDOW.INC')          !declare WindowManager

  INCLUDE('ABBROWSE.INC')          !declare BrowseClass

  INCLUDE('ABEIP.INC')             !declare Edit-in-place classes

 

  MAP

  END

Property   FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD

NameKey     KEY(PR:FieldName),NOCASE,OPT

Record     RECORD,PRE()

FieldName   STRING(30)

Color       STRING(20)

Hidden      STRING(1)

IconFile    STRING(30)

ControlType STRING(12)

          END

         END

                   

PropView VIEW(Property)

        END

 

PropQ         QUEUE

PR:FieldName   LIKE(PR:FieldName)

PR:Color       LIKE(PR:Color)

PR:ControlType LIKE(PR:ControlType)

PR:Hidden      LIKE(PR:Hidden)       !edit this LIST field with a CHECK control

PR:IconFile    LIKE(PR:IconFile)

ViewPosition   STRING(1024)

             END

 

PropWindow WINDOW('Browse Field Properties'),AT(,,318,137),IMM,SYSTEM,GRAY

      LIST,AT(8,4,303,113),USE(?PropList),IMM,HVSCROLL,FROM(PropQ),|

      FORMAT( '50L(2)|_M~Field Name~@s30@[70L(2)|_M~Color~@s20@' &|

          '60L(2)|_M~Control Type~@s12@' &|

          '20L(2)|_M~Hide~L(0)@s1@/130L(2)|_M~Icon File~@s30@]|M')

      BUTTON('&Insert'),AT(169,121),USE(?Insert)

      BUTTON('&Change'),AT(218,121),USE(?Change),DEFAULT

      BUTTON('&Delete'),AT(267,121),USE(?Delete)

     END

 

Edit:PR:Hide  CLASS(EditCheckClass) !declare Edit:PR:Color-EIP CHECK control

Init         PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar),VIRTUAL

             END

 

ThisWindow CLASS(WindowManager)

Init        PROCEDURE(),BYTE,PROC,VIRTUAL

Kill        PROCEDURE(),BYTE,PROC,VIRTUAL

          END

 

BRW1       CLASS(BrowseClass) !declare BRW1, the BrowseClass object

Q           &PropQ            ! that drives the EditClass objects--

          END                ! i.e. calls Init, TakeEvent, Kill

 

GlobalErrors    ErrorClass

Access:Property CLASS(FileManager)

Init             PROCEDURE

               END

 

Relate:Property CLASS(RelationManager)

Init             PROCEDURE

Kill             PROCEDURE,VIRTUAL

               END

GlobalRequest   BYTE(0),THREAD

GlobalResponse  BYTE(0),THREAD

VCRRequest      LONG(0),THREAD

CODE

GlobalErrors.Init

Relate:Property.Init

GlobalResponse = ThisWindow.Run()

Relate:Property.Kill

GlobalErrors.Kill

 

ThisWindow.Init  PROCEDURE()

ReturnValue    BYTE,AUTO

CODE

SELF.Request = GlobalRequest

ReturnValue = PARENT.Init()

SELF.FirstField = ?PropList

SELF.VCRRequest &= VCRRequest

SELF.Errors &= GlobalErrors

Relate:Property.Open

BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)

OPEN(PropWindow)

SELF.Opened=True

 BRW1.Q &= PropQ

 BRW1.AddSortOrder(,PR:NameKey)

 BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)

 BRW1.AddField(PR:Color,BRW1.Q.PR:Color)

 BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)

 BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)

 BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)

 BRW1.AddEditControl(Edit:PR:Hide,4)   !Use Edit:PR:Hide to edit BRW1 column 4

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

 BRW1.InsertControl=?Insert

 BRW1.ChangeControl=?Change

 BRW1.DeleteControl=?Delete

 SELF.SetAlerts()

 RETURN ReturnValue

 

ThisWindow.Kill  PROCEDURE()

ReturnValue    BYTE,AUTO

 CODE

 ReturnValue = PARENT.Kill()

 Relate:Property.Close

 RETURN ReturnValue

 

Edit:PR:Hide.Init PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar)

CODE

PARENT.Init(FieldNumber,ListBox,UseVar)

SELF.Feq{PROP:Text}='Hide '         !set EIP check box text

SELF.Feq{PROP:Value,1}='Y'          !set EIP check box true value

SELF.Feq{PROP:Value,2}='N'          !set EIP check box false value

 

Access:Property.Init PROCEDURE          !initialize FileManager

CODE

PARENT.Init(Property,GlobalErrors)

SELF.FileNameValue = 'Property'

SELF.Buffer &= PR:Record

SELF.Create = 1

SELF.AddKey(PR:NameKey,'PR:NameKey',0)

 

Relate:Property.Init PROCEDURE          !initialize RelationManager

CODE

Access:Property.Init

PARENT.Init(Access:Property,1)

 

Relate:Property.Kill PROCEDURE          !shut down RelationManager

CODE

Access:Property.Kill

PARENT.Kill