[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
FUNCTION 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
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson