| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > BufferedPairsClass >====== BufferedPairsClass Overview {{c6h0009.jpg|C6H0009.jpg}} ====== | [[bufferedpairsclass.htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[bufferedpairsclass properties.htm|{{btn_next_n.gif|Next page}}]] | | || The BufferedPairsClass is a FieldPairs class with a third buffer area (a "save" area). The BufferedPairsClass can compare the save area with the primary buffers, and can restore data from the save area to the primary buffers (to implement a standard "cancel" operation). **BufferedPairsClass Concepts** The BufferedPairsClass lets you move data between field pairs, and lets you compare the field pairs to detect whether any changes occurred since the last operation. This class provides methods that let you identify or "set up" the targeted field pairs. **Note: The paired fields need not be contiguous in memory, nor do they need to be part of a structure. You can build a virtual structure simply by adding a series of otherwise unrelated fields to a BufferedPairsClass object. The BufferedPairsClass methods then operate on this virtual structure.** Once the field pairs are identified, you call a single method to move all the fields in one direction (left to right), and others single methods to move all the fields in the other directions (right to left, left to buffer, etc.). You simply have to remember which entity (set of fields) you described as "left" and which entity you described as "right." Other methods compares the sets of fields and return a value to indicate whether or not they are equivalent. **BufferedPairsClass Relationship to Other Application Builder Classes** The BufferedPairsClass is derived from the FieldPairsClass. The BrowseClass, ViewManager, and RelationManager use the FieldPairsClass and BufferedPairsClass to accomplish various tasks. **BufferedPairsClass ABC Template Implementation** Various ABC Library objects instantiate BufferedPairsClass objects as needed; therefore, the template generated code does not directly reference the BufferedPairsClass. **BufferedPairsClass Source Files** The BufferedPairsClass source code is installed in the Clarion \LIBSRC folder. The BufferedPairsClass source code and their respective components are contained in: ABUTIL.INC BufferedPairsClass declarations ABUTIL.CLW BufferedPairsClass method definitions **BufferedPairsClass Conceptual Example** The following example shows a typical sequence of statements to declare, instantiate, initialize, use, and terminate a BufferedPairsClass object. Let's assume you have a Customer file declared as: **Customer FILE,DRIVER('TOPSPEED'),PRE(CUST),CREATE,BINDABLE** **ByNumber KEY(CUST:CustNo),NOCASE,OPT,PRIMARY** **Record    RECORD,PRE()** **CustNo     LONG** **Name       STRING(30)** **Phone      STRING(20)** **Zip        DECIMAL(5)** **          END** **         END** And you have a Customer queue declared as: **CustQ  QUEUE** **CustNo  LONG** **Name    STRING(30)** **Phone   STRING(20)** **Zip     DECIMAL(5)** **       END** And you want to move data between the file buffer and the queue buffer. ** INCLUDE('ABUTIL.INC')       !declare BufferedPairsClass** **Fields  BufferedPairsClass   !declare Fields object** ** CODE** ** Fields.Init                               !initialize Fields object** ** Fields.AddPair(CUST:CustNo, CustQ.CustNo) !establish CustNo pair** ** Fields.AddPair(CUST:Name,  CustQ.Name)    !establish Name pair** ** Fields.AddPair(CUST:Phone, CustQ.Phone)   !establish Phone pair** ** Fields.AddPair(CUST:Zip,  CustQ.Zip)      !establish Zip pair** ** Fields.AssignLeftToRight    !copy from Customer FILE to CustQ QUEUE** ** Fields.AssignLeftToBuffer   !copy from Customer FILE to save area** ** !accept user input** ** IF ACCEPTED() = ?RestoreButton** **  Fields.AssignBufferToLeft  !copy from save area to Customer FILE** **  Fields.AssignBufferToRight !copy from save area to Customer QUEUE** ** END** ** Fields.Kill          !shut down Fields object**