VIEWPORT() Short: ------ VIEWPORT() Multi-optional data entry engine Returns: -------- Nothing Syntax: ------- VIEWPORT([lModify],[aFields,aDesc],[aPict],[aVal],[aLook],; [aOther],[aEdit],[lCarry],[cTitle]) Description: ------------ Presents a generic data entry screen with multiple movement, search, view and editing capabilities. [lModify] Logical - this is (.T.) if you want to give the user Add,Edit,Delete, and (.F.) if not. Defaults to (.T.) Arrays 1-5 and array 7 must have the same # of elements. (default is # of fields in DBF). You may pass a nil to bypass and activate the default for any of these arrays. [aFields] An array of field names. Defaults to all fields in DBF. [aDesc] An array of field descriptions. Defaults to field names. You must pass [aFields] if you wish to pass [aDesc] [aPict] is an array of PICTURES as Character expressions to correspond with the [aFields] array. Default is pictures as derived by ED_G_PIC(). If you pass this array, each element must contain at least a "". [aVal] is an array of VALID clauses and messages to correspond with the [aFields] array. Each is in the form "{valid clause};{valid message}" The FIELD is represented as a token "@@" in the valid clause which is replaced with the current edited value at edit time. Note: Field values are loaded into an array when editing, so field names in the valid are not meaningful. Field name FIRST might be aValues[12]. At edit time, the "@@ " will be replaced with "aValues[12]". i.e. "!empty(@@);Must not be empty" If you pass this array, each element must contain at least a "". [aLook] is an array of Lookup definitions corresponding to the [aFields] array. These are delimited strings with 1-4 component parts matching the first four parameters of SMALLS(). Delimiter is a semicolon (;). As an example, to make a lookup definition corresponding to the COMPANY field in the [aFields] array, which will lookup on the field CORPNAME in the database INSTIT, titling the box "Company" and KEYBOARDing the contents of CORPNAME if CR pressed "CORPNAME;Company;%INSTIT;CORPNAME". If you realize that these 4 components are parsed and sent as parameters to SMALLS(), you will get the idea. If you pass this array, each element must contain at least a "". [aOther] [1-9 elements] Each of elements 1-9 is a delimited string in the format "{option};{action}" where option is a displayed menu option and action is a proc to be executed. i.e.: "Form Letters;FORMLETR()" "List Myfile;FILEREAD(2,2,22,78,'FMYFILE.TXT')" Pass 1-9 option/proc combinations. These will be presented as an 'Other' menu. THESE PROCS MUST BE DECLARED EXTERNAL!!! [aEdit] an array of logicals matches the FIELDS array and defines which fields may be edited (.t.) and which are display only (.f.) If you pass this array, each element must be of TYPE Logical. [lCarry] Pop up 'Carry Forward' message when adding? True/False. Default is True. [cTitle] Optional title. Default is " V.I.E.W P.O.R.T for file: "+TRIM(ALIAS())+' ' Examples: --------- local aFlds[fcount()] local aFdes[fcount()] local aFval[fcount()] local aFloo[fcount()] local aFedit[fcount()] afields(aFlds) afields(aFdes) afill(aFval,"") afill(aFloo,"") afill(aFedit,.t.) // valids for fields 5 and 6 aFval[5]:="!empty(@@);Cannot be empty" aFval[6]:="!empty(@@);Cannot be empty" // lookups for fields 5 and 6 aFloo[5] := "First;First Name;%user%;trim(first)" aFloo[6] := "Last;Last Name;%user%;trim(Last)" // 'other' menu array aOther := { "Read PRG;FILEREAD(1,1,23,79,'s_viewp.prg')",; "Do Form Letters ;FORMLETR()",; "Frequency Analysis;FREQANAL()" } VIEWPORT(.t.,aFlds,aFdes,nil,aFval,aFloo,aOther) Source: ------- S_VIEWP.PRG
Tag Archives: FILEREAD()
SP_FULLDIR
FULLDIR() Short: ------ FULLDIR() Interactively navigate directories Returns: -------- <lSelected> => Directory was selected Syntax: ------- FULLDIR([lChange],[@cDirName]) Description: ------------ Interactively navigates directories on the current drive. Allows reading of a file ( with FILEREAD() ) in a directory. If file is DBF, does a DBEDIT browse (watch your memory..) [lChange] True - change to selected directory False - don't change to selected directory Default is True - change [@cDirName] Char string passed by reference, will contain name of selected directory on return. Examples: --------- cNewDir := "" if FULLDIR(.F.,@cNewDir) SET DEFAULT TO (cNewDir) ?"New directory is:" ?Curdir() endif if FULLDIR(.t.) ?"New directory is:" ?Curdir() endif Source: ------- S_FULLD.PRG
SP_FILEREAD
FILEREAD() Short: ------ FILEREAD() Lists a text file of unlimited size Returns: -------- nothing Syntax: ------- FILEREAD([nTop,nLeft,nBottom,nRight],[cFileName],[cTitle],; [lSearch],[lMark]) Description: ------------ Lists text file [cFileName] of unlimited size in a programmer definable window of dimensions [nTop..nRight] Allows up down right left scrolling. Use this for reports or output sent to a disk file. If [cFileName] is not passed, a box asks for the filespec and then allows a picklist of files of that spec. If [cFileName] is passed as a wildcard (i.e. "*.DOC"). a picklist of files of that spec is presented. If [nTop..nRight] are not passed, a default window of dimensions 2,2,22,78 is used. [cTitle] is an optional title. This overrides the default which is the file name. [lSearch] is a switch to allow text searches. Default is True [lMark] is a switch to allow block marking (with Copy to File or Print) Default is True. Examples: --------- REPORT FORM summary TO summary.txt FILEREAD(2,2,22,78,"SUMMARY.TXT","Summary File") Notes: ------- Fileread() will use SET DEFAULT if no path is specified. Source: ------- S_FILER.PRG