home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR2
/
CLATPL.ZIP
/
CLARION9.TPX
< prev
Wrap
Text File
|
1993-07-26
|
10KB
|
258 lines
#!------------------------------------------------------------------------------
#!
#! CLARION9.TPX
#!
#! %StandardHeader
#! %GenerateFormulas
#! %GenerateFormula
#! %OpenPrimary
#! %OpenSecondaryFiles
#! %GetSecondaryRecords
#! %ScreenSetupRoutine
#! %HotKeyRoutines
#! %PulldownEditRoutines
#! %CloseOpenedFiles
#! %CloseFilesFlags
#!------------------------------------------------------------------------------
#!
#GROUP(%StandardHeader)
#!------------------------------------------------------------------------------
#!
#! Standard Header
#!
#! The following statements are inserted after every PROCEDURE statement
#!
#!------------------------------------------------------------------------------
OMIT('╝')
╔════════════════════════════════════════════════════════════════════════════╗
║ %Procedure - %ProcedureDescription #<!Generated Procedure ║
╚════════════════════════════════════════════════════════════════════════════╝
#GROUP(%GenerateFormulas)
#!------------------------------------------------------------------------------
#!
#! Generate Formulas
#!
#! The formula editor generates computed fields and conditional fields.
#! Computed fields assign the value of a numeric or string expression to a
#! variable. Conditional fields evaluate a logical expression, then assign
#! the value of a true expression or a false expression to a variable. The
#! order of formulas is important because formulas may produce intermediate
#! values used in later formulas.
#!
#! Each formula has an optional class. If the symbol %CodePosition is
#! null, every formula is generated. If %CodePosition is not null, only
#! formulas with matching classes are generated.
#!
#!------------------------------------------------------------------------------
#FOR(%Formula)
#IF((UPPER(LEFT(%FormulaClass)) = UPPER(%CodePosition) OR %CodePosition = %NULL))
#IF(%FormulaType = 'COMPUTED')
%Formula = %FormulaComputation #<!%FormulaDescription
#ELSIF(%FormulaType = 'CONDITION')
IF %FormulaCondition #<!%FormulaDescription
%Formula = %FormulaTrue
#IF(%FormulaFalse)
ELSE
%Formula = %FormulaFalse
#ENDIF
END
#ENDIF
#ENDIF
#ENDFOR
#GROUP(%GenerateFormula)
#!------------------------------------------------------------------------------
#!
#! Generate Formula
#!
#! The formula editor generates computed fields and conditional fields.
#! Computed fields assign the value of a numeric or string expression to a
#! variable. Conditional fields evaluate a logical expression, then assign
#! the value of a true expression or a false expression to a variable. The
#! order of formulas is important because formulas may produce intermediate
#! values used in later formulas.
#!
#! This group will generate a single formula. If more than one formula
#! is needed, it should be placed in a template #FOR statement:
#!
#! #FOR(%Formula)
#! #INSERT(%GenerateFormula)
#! #ENDFOR
#!
#! Or, if only a selected formula class is needed:
#!
#! #FOR(%Formula)
#! #IF(%FormulaClass <> 'FILTER')
#! #INSERT(%GenerateFormula)
#! #ENDIF
#! #ENDFOR
#!
#!------------------------------------------------------------------------------
#IF(%FormulaType = 'COMPUTED')
%Formula = %FormulaComputation #<! Computed Formula
#ELSE
IF %FormulaCondition #<! IF FormulaCondition
%Formula = %FormulaTrue #<! condition is true
#IF(%FormulaFalse)
ELSE
%Formula = %FormulaFalse #<! condition is true
#ENDIF
END #<! End IF FormulaCondition
#ENDIF
#!------------------------------------------------------------------------------
#!
#! Open Primary
#!
#! To avoid a long delay when loading a program, each procedure opens the
#! files it uses. Opening an open file takes negligible time. %FileMode
#! contains the parameters of the OPEN statement that controls how a file
#! is accessed (read, write, etc.) and shared (share, exclusive, etc.)
#!
#!------------------------------------------------------------------------------
#GROUP(%OpenPrimary)
#IF(%CloseFiles) #!Generate function for close
%Primary::Opened = CheckOpen(%Primary) #<!Ensure %Primary file is open
#ELSE
CheckOpen(%Primary) #<!Ensure %Primary file is open
#ENDIF
#!------------------------------------------------------------------------------
#!
#! Get Secondary Records
#!
#! There is a secondary file for every active relationship of the primary
#! file. A relationship is active for a given procedure if any field in
#! the secondary file is in use by the screen, report, or formula editor.
#!
#!------------------------------------------------------------------------------
#GROUP(%GetSecondaryRecords) #!Get all lookup records
#FOR(%Secondary) #! for fields in the list box
#IF(%SecondaryType = 'MANY:1') #!Check for lookup files
#FIX(%File,%SecondaryTo)
#FIX(%Relation,%Secondary)
#FOR(%RelationKeyField)
#IF(%RelationKeyFieldLink)
%RelationKeyField = %RelationKeyFieldLink #<!Assign linking field value
#ENDIF
#ENDFOR
GET(%Secondary,%RelationKey) #<!Lookup record
#FIX(%File,%Secondary)
IF ERRORCODE() THEN CLEAR(%FilePre:Record). #<!Clear record if unsuccessful
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Open Secondary Files
#!
#! This group will open any secondary files within the file schematic.
#!
#!------------------------------------------------------------------------------
#GROUP(%OpenSecondaryFiles)
#FOR(%Secondary)
#IF(%CloseFiles) #!Generate function for close
%Secondary::Opened = CheckOpen(%Secondary) #<!Ensure %Secondary file is open
#ELSE
CheckOpen(%Secondary) #<!Ensure %Secondary file is open
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Screen Setup Routine
#!
#! The following statements generate Setup routines to be placed in the
#! CASE SELECTED() structure.
#!
#!------------------------------------------------------------------------------
#GROUP(%ScreenSetupRoutines)
#FOR(%ScreenField)
#IF(%ScreenFieldSetup)
OF %ScreenField #<!Setup %ScreenSetupField field
%ScreenFieldSetup
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Hot Key Routines
#!
#! The following statements generate a CASE structure to insert
#! calls to any Hot Key procedures which have been identified in the
#! Screen Formatter.
#!
#!------------------------------------------------------------------------------
#GROUP(%HotKeyRoutines)
#FOR(%HotKey)
CASE KEYCODE()
#FOR(%HotKey)
OF %HotKey #<! User defined HotKey
%HotKeyProc #<! HotKey Procedure
#ENDFOR
END
#BREAK
#ENDFOR
#!
#!------------------------------------------------------------------------------
#!
#! Screen Edit Routine
#!
#! The following statements generate Edit routines to be placed in the
#! CASE FIELD() structure.
#!
#!
#!------------------------------------------------------------------------------
#GROUP(%ScreenEditRoutines)
#FOR(%ScreenField)
#IF(%ScreenFieldEdit)
OF %ScreenField #<!Edit %ScreenEditField field
%ScreenFieldEdit
#ENDIF
#ENDFOR
#FOR(%PulldownField)
#IF(%PulldownFieldProc)
OF %PulldownField #<!For a selected menu item
%PulldownFieldProc #<! execute its procedure
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Pulldown Field Routine
#!
#! The following statements generate Edit routines to be placed in the
#! CASE FIELD() structure for Pulldown.
#!
#!
#!------------------------------------------------------------------------------
#GROUP(%PulldownEditRoutines)
#FOR(%PulldownField) #! add all procedure or
#IF(%PulldownFieldType = 'PROCEDURE') #! source code calls
OF %PulldownField #<!For a Pulldown field
%PulldownFieldProc #<! execute its procedure
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Close Opened Files
#!
#! This group will close any files opened by the current procedure
#!
#!------------------------------------------------------------------------------
#GROUP(%CloseOpenedFiles)
#IF(%CloseFiles) #!Generate functio n for close
IF %Primary::Opened THEN CLOSE(%Primary). #<!Close files opened by proc
#FOR(%Secondary)
IF %Secondary::Opened THEN CLOSE(%Secondary). #<!Close files opened by proc
#ENDFOR
#ENDIF
#!------------------------------------------------------------------------------
#!
#! Close Opened Files Flags
#!
#! This group will declare flags to signal the procedure to close
#! the files opened by the current procedure
#!
#!------------------------------------------------------------------------------
#GROUP(%CloseFilesFlags)
#IF(%CloseFiles) #!Generate function for close
%Primary::Opened BYTE
#FOR(%Secondary)
%Secondary::Opened BYTE
#ENDFOR
#ENDIF