![]() |
|
![]() |
| ClearFormOnAdd | DefineCommandLine | DefineCursorPosition | |
| RecordEd | RecordEdH | RecordEdit | RecordEditH |
nul : constant character := character'val (0);
esc : constant character := character'val (27);
type Full_Character is array (1 .. 2) of character;
type Full_Character_Array is array (ModSys.S_Natural range <>) of Full_Character;
type PreCommandProcType is access
procedure (command : in out Full_Character);
pragma Convention
(WIN32,
PreCommandProcType);
type PreModifyProcType is access
procedure (Process : in character;
exitNo : in ModSys.S_Natural;
option : in out character);
pragma Convention
(WIN32,
PreModifyProcType);
type PostLocateProcType is access
procedure;
pragma Convention
(WIN32,
PostLocateProcType);
-- default valid keystrokes
defaultKeys : Full_Character_Array (1 .. 9) := ((ASCIIX.UpperE,
nul),
(esc,
nul),
(ASCIIX.UpperL,
nul),
(ASCIIX.UpperN,
nul),
(ASCIIX.UpperP,
nul),
(ASCIIX.UpperA,
nul),
(ASCIIX.UpperM,
nul),
(ASCIIX.UpperD,
nul),
(ASCIIX.Space,
nul));
procedure ClearFormOnAdd
(flag : in boolean);
--*
-- ClearFormOnAdd - Clear the form when add requested.
--
--
-- CALLING SEQUENCE -
--
-- ClearFormOnAdd (flag);
--
-- ENTRY -
--
-- flag : boolean
-- TRUE - Clear relation fields before requested data entry.
-- Default is TRUE;
--
procedure DefineCommandLine
(validkeys : in Full_Character_Array;
validNumber : in ModSys.S_Natural;
validStringI : in string;
Form : in string;
promptline : in string;
promptRow : in ModSys.S_Natural);
--*
-- DefineCommandLine - Define command line and valid keystrokes.
--
-- This procedure establishes the command line or form to display and the
-- valid keys that can be entered.
--
-- CALLING SEQUENCE -
--
-- DefineCommandLine (validkeys, validNumber, validStringI, form,
-- promptline, promptRow);
--
-- ENTRY -
--
-- validkeys : Full_Character_Array
-- An array of valid keystrokes that the user can enter. The first
-- nine are order-dependent on action and default as follows -
--
-- 1 - ('E', nul) Exit
-- 2 - (esc, nul) Exit
-- 3 - ('L', nul) Locate
-- 4 - ('N', nul) Next
-- 5 - ('P', nul) Previous
-- 6 - ('A', nul) Add
-- 7 - ('M', nul) Modify
-- 8 - ('D', nul) Delete
-- 9 - (' ', nul) do nothing
--
-- Up to 11 other keystrokes can be defined. To invalidate a
-- standard function enter a (nul, nul) in the proper position.
--
-- validNumber : ModSys.S_Natural
-- Number of commands in the validKeys array.
--
-- validStringI : string
-- Up to a 20-character string displayed when an invalid key is
-- pressed. Default is "ELNPAMD".
--
-- form : string
-- Form name to display for command prompt. If null string,e prompt
-- line will be used.
--
-- promptline : string
-- Up to 80-character string written on line 24 for command prompt.
-- Only used if form is not defined. If null string and no form, then
-- no prompt is given.
--
-- promptRow : ModSys.S_Natural
-- Row to place the prompt line on. (1..25);
--
procedure DefineCursorPosition
(row : in ModSys.S_Natural;
col : in ModSys.S_Natural);
--*
-- DefineCursorPosition - Row, col where cursor will await command.
--
-- CALLING SEQUENCE -
--
-- DefineCursorPosition (row, col);
--
-- ENTRY -
--
-- row : ModSys.S_Natural
-- row number (1..25) default = 24.
--
-- col : ModSys.S_Natural
-- column number (1..80) default = 80.
--
procedure RecordEdit
(FormName : in string;
RelationName : in string;
KeyFieldName : in string);
--*
-- RecordEdit - Edit a relation's records.
--
--
-- This procedure allows editing of a relations records. Functions
-- include locating, finding the next record, finding the previous
-- record, adding a record, modifying an existing record, and deleting
-- record.
--
-- Commands processed in this procedure include the following
-- (all other responses are invalid).
--
-- 'A'dd 'N'ext
-- 'D'elete 'M'odify
-- 'E'xit 'P'revious
-- 'L'ocate esc Exit
--
-- CALLING SEQUENCE -
--
-- RecordEdit (formName, relationName, keyFieldName);
--
-- ENTRY -
--
-- formName : string
-- Name of form used for editing
--
-- relationName : string
-- Name of record to be edited
--
-- keyFieldName : string
-- Name of primary keyed field within the relation being edited that
-- that uniquely identifies a record. An entry field in the form must
-- exist for this field. If the primary field is concatenated, the
-- fields which are components of that field must have entry fields
-- on the form.
--
-- EXAMPLE -
--
-- with MultSage;
-- with MEditLib;
--
-- procedure Test is
-- begin
-- MultSage.OpenSystem ("Test.dfl",3,3,3000);
-- MSageLib.RecordEdit ("MyForm","MyRel","MyFld");
-- MultSage.CloseSystem;
-- end Test;
--
procedure RecordEd
(FormName : in string;
RelationName : in string;
KeyFieldName : in string;
PreCommand : in PreCommandProcType;
PreModify : in PreModifyProcType;
PostLoc : in PostLocateProcType);
--*
-- RecordEd - Edit a relation's records.
--
--
-- This procedure allows editing of a relations records. Functions
-- include locating, finding the next record, finding the previous
-- record, adding a record, modifying an existing record, and deleting
-- record.
--
-- Commands processed in this procedure include the following
-- (all other responses are invalid).
--
-- 'A'dd 'N'ext
-- 'D'elete 'M'odify
-- 'E'xit 'P'revious
-- 'L'ocate esc Exit
--
-- CALLING SEQUENCE -
--
-- RecordEd (formName, relationName, keyFieldName.
-- PreCommand, PreModify, PostLocate);
--
-- ENTRY -
--
-- formName : string
-- Name of form used for editing
--
-- relationName : string
-- Name of record to be edited
--
-- keyFieldName : string
-- Name of primary keyed field within the relation being edited that
-- that uniquely identifies a record. An entry field in the form must
-- exist for this field. If the primary field is concatenated, the
-- fields which are components of that field must have entry fields
-- on the form.
--
-- Supplied procedures include -
--
-- PreCommand
-- A procedure executed following any command entry. The command
-- may be changed to redirect execution.
--
-- PreModify
-- A procedure called during a modify, add, delete or locate
-- following the display and entry into the form. Returns an
-- option of 'C' to continue processing, 'R' to redisplay the
-- form, 'E' to exit process, or 'T' to terminate the
-- RecordEditH routine.
--
-- PostLocate
-- A procedure executed after the actual locate is successfully
-- executed. If SageError is returned as non-zero after execution
-- of a locate type command, this procedure will not be executed.
--
procedure RecordEditH
(FormNameI : in string;
RelationNameI : in string;
KeyFieldNameI : in string;
JoinFieldNameI : in string;
FatherRelationI : in string;
FatherJoinFieldI : in string);
--*
-- RecordEditH - Edit relation's records using hierarchical restrictions.
--
--
-- This procedure allows editing of a relations records.
-- Functions include locating, finding the next record, finding
-- the previous record, adding a record, modifying an existing
-- record, and deleting record.
--
-- The records available for editing may be restricted by a
-- joined field from another existing record. Only those records
-- whose "join" field is equal to the "join" field of the defined
-- "father" relation may be accessed.
--
-- The default commands are
--
-- Exits
-- -----
-- 1 - 'E'xit
-- 2 - esc Exit
-- locate commands
-- ---------------
-- 3 - 'L'ocate
-- 4 - 'N'ext
-- 5 - 'P'revious
-- modify commands
-- ---------------
-- 6 - 'A'dd
-- 7 - 'M'odify
-- 8 - 'D'elete
-- other commands
-- --------------
-- 9 - ' ' do nothing
--
-- These defaults can be changed using the DefineCommandLine procedure.
-- The first nine entries are order-dependent and the function can be
-- redefined to any other key stroke by changing the command entry for
-- that position.
--
-- CALLING SEQUENCE -
--
-- RecordEditH (formNameI, relationNameI, keyFieldNameI,
-- joinFieldNameI, fatherRelationI, fatherJoinFieldI);
--
-- ENTRY -
--
-- formNameI : string
-- Name of form used for editing
--
-- relationNameI : string
-- Name of record to be edited
--
-- keyFieldNameI : string
-- Name of primary keyed field within the relation being edited
-- that uniquely identifies a record. An entry field on the form
-- must exist for this field. If the primary field is concatenated,
-- the fields which are components of that field must have entry
-- fields on the form.
--
-- joinFieldNameI : string
-- Name of field in relation being edited to restrict by.
--
-- fatherRelationI : string
-- Name of other relation that contains a field to restrict the
-- editing of the fields in 'relationNameI'.
--
-- fatherJoinFieldI : string
-- Name of field within 'FatherRelation' to restrict access to the
-- relation being edited. The current contents are compared against
-- 'joinFieldNameI' for equality.
--
procedure RecordEdH
(FormNameI : in string;
RelationNameI : in string;
KeyFieldNameI : in string;
JoinFieldNameI : in string;
FatherRelationI : in string;
FatherJoinFieldI : in string;
PreCommand : in PreCommandProcType;
PreModify : in PreModifyProcType;
PostLoc : in PostLocateProcType);
--*
-- RecordEdH - Edit relation's records using hierarchical restrictions.
--
--
-- This procedure allows editing of a relations records.
-- Functions include locating, finding the next record, finding
-- the previous record, adding a record, modifying an existing
-- record, and deleting record.
--
-- This procedure allows the programmer to execute three variable
-- procedures which are supplied at the time of instantiation . The
-- The first, 'PreCommand' procedure is executed after command letter
-- is entered and any normal recordEdit procedures executed. The
-- second,'PreModify' procedure is executed after each form is displayed
-- during a 'modify', 'add' and 'locate' command and before these
-- commands are executed. The third procedure, 'PostLocate' is executed
-- after each locate type command is performed and before the command
-- line is again displayed. This is only executed if the 'SageError' is
-- returned as 0 after a locate operation.
--
-- The records available for editing may be restricted by a
-- joined field from another existing record. Only those records
-- whose "join" field is equal to the "join" field of the defined
-- "father" relation may be accessed.
--
-- The default commands are
--
-- Exits
-- -----
-- 1 - 'E'xit
-- 2 - esc Exit
-- locate commands
-- ---------------
-- 3 - 'L'ocate
-- 4 - 'N'ext
-- 5 - 'P'revious
-- modify commands
-- ---------------
-- 6 - 'A'dd
-- 7 - 'M'odify
-- 8 - 'D'elete
-- other commands
-- --------------
-- 9 - ' ' do nothing
--
-- These defaults can be changed using the DefineCommandLine procedure.
-- The first nine entries are order-dependent and the function can be
-- redefined to any other key stroke by changing the command entry for
-- that position.
--
-- CALLING SEQUENCE -
--
-- RecordEdH (formNameI, relationNameI, keyFieldNameI,
-- joinFieldNameI, fatherRelationI, fatherJoinFieldI,
-- PreCommand, PreModify, PostLocate);
--
-- ENTRY -
--
-- formNameI : string
-- Name of form used for editing
--
-- relationNameI : string
-- Name of record to be edited
--
-- keyFieldNameI : string
-- Name of primary keyed field within the relation being edited
-- that uniquely identifies a record. An entry field on the form
-- must exist for this field. If the primary field is concatenated,
-- the fields which are components of that field must have entry
-- fields on the form.
--
-- joinFieldNameI : string
-- Name of field in relation being edited to restrict by.
--
-- fatherRelationI : string
-- Name of other relation that contains a field to restrict the
-- editing of the fields in 'relationNameI'.
--
-- fatherJoinFieldI : string
-- Name of field within 'FatherRelation' to restrict access to the
-- relation being edited. The current contents are compared against
-- 'joinFieldNameI' for equality.
--
-- Supplied procedures include -
--
-- PreCommand
-- A procedure executed following any command entry. The command
-- may be changed to redirect execution.
--
-- PreModify
-- A procedure called during a modify, add, delete or locate
-- following the display and entry into the form. Returns an
-- option of 'C' to continue processing, 'R' to redisplay the
-- form, 'E' to exit process, or 'T' to terminate the
-- RecordEditH routine.
--
-- PostLocate
-- A procedure executed after the actual locate is successfully
-- executed. If SageError is returned as non-zero after execution
-- of a locate type command, this procedure will not be executed.
--
-- EXAMPLE -
--
-- procedure Test is
--
-- nul : constant character := character'val(0);
--
-- keys : MEditlib.Full_Character_Array(1..10) :=
-- (('E' , nul), -- Exit 1
-- ('Q' , nul), -- Exit 2
-- ('L' , nul), -- Locate
-- (nul , 'P'), -- Next(down arrow)
-- (nul , 'H'), -- Previous(up arrow)
-- ('A' , nul), -- Add
-- ('M' , nul), -- Modify
-- ('D' , nul), -- Delete
-- (' ' , nul), -- No action
-- ('T' , nul));-- Application
--
-- promptline : string(1..60) := (others => ' ');
--
-- procedure PreCom
-- (command : in out MEditlib.Full_Character) is
--
-- Tcommand : constant MEditlib.Full_Character := ('T' , nul);
--
-- begin
-- if MEditlib."="(command,Tcommand) then
-- Sage.DisplayMessage("T command was pressed.",TRUE);
-- command(1) := ' ';
-- end if;
-- end PreCom;
--
--
-- procedure PreMod
-- (process : in character;
-- exitNo : in natural;
-- option : in out character) is
--
-- class : natural;
--
-- begin
-- if exitNo = 21 then -- increment field and redisplay i.e.,. no edit action
-- Sage.GetFieldI("RELATION","Field1",fieldValue);
-- Sage.PutFieldI("RELATION","Field1",fieldValue+1);
-- option := 'R';
-- elsif exitNo = 10 then -- continue with edit
-- option := 'C';
-- else -- exit edit process
-- option := 'E';
-- end if;
-- end PreMod;
--
--
-- procedure NewEdit is new MEditlib.RecordEditH
-- (PreCommand => PreCom,
-- PreModify => PreMod,
-- PostLocate => Dumb3);
--
-- begin -- of Test procedure
-- Sage.DefineFunctionKey(8 ,nul,';');
-- Sage.DefineFunctionKey(21,nul,'<');
-- Sage.DefineFunctionKey(22,character'val(27),nul);
-- Sage.OpenSystem("DATABASE.DFL",4,4,10000);
--
-- promptline(1..60) :=
-- "<E>xit, <Q>uit, <A>dd, <M>odify, <L>ocate, up/down to view ";
-- MEditlib.DefineCursorPosition(24,72);
-- MEditlib.DefineCommandLine(keys,10,"EQAMLT or up,down","",promptline,24);
--
--
-- MEditlib.ClearFormOnAdd(FALSE);
--
-- NewEdit("EditForm","RELATION","KeyField","","","");
--
-- Sage.CloseSystem;
--
-- end Test;
--
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance