Rate this:

AASKIP()
Short:
------
AASKIP() Use for skipblock for arrays in Tbrowse
Returns:
--------
<nSkipcount> => number skipped, forward or backward
Syntax:
-------
AASKIP(nSkip,@nElement,nMaxRows)
Description:
------------
Use this to create the SKIPBLOCK for a tbrowse that browses
an array, as in :
aTbrowseObject:SKIPBLOCK := {|n|aaskip(n,@nElement,len(aArray)}
<nSkip> is passed in by Tbrowse as a +- value, or
as zero.
<nElement> is the current array element number.
PASSED IN BY REFERENCE!
<nMaxrows> refers to the length of the array being
browsed
Examples:
---------
// this example browses the fields in a database
local nLastKey, nElement := 1
local aArray := dbstruct()
local oTb := tBrowseNew(2,2,20,78)
oTb:addcolumn(tbcolumnew("Name",{||aArray[nElement,1]}))
oTb:addcolumn(tbcolumnew("Type", {||aArray[nElement,2]}))
oTb:addcolumn(tbcolumnew("Len " , {||aArray[nElement,3]}))
oTb:addcolumn(tbcolumnew("Deci", {||aArray[nElement,4]}))
oTb:Skipblock := {|n|aaskip(n,@nElement,len(aArray)}
oTb:goTopBlock := {||nElement := 1}
oTb:goBottomBlock := {||nElement := len(aArray)}
while .t.
while !oTb:stabilize()
end
nLastKey := inkey(0)
do case
/// various actions.....
endcase
end
Notes:
-------
Aaskip() is used by a lot of SuperLib functions, but
is very useful by itself for creating array tbrowses.
Source:
-------
S_AASKIP.PRG

A2TOSING()
Short:
------
A2TOSING() Copies a given element from an array of arrays
Returns:
--------
<aSingle> => a single dimensioned array
Syntax:
-------
A2TOSING(a2Dim,nElement)
Description:
------------
Copies a given element position from a 2 dimensioned
array of arrays into a single dimensioned array. <a2dim> is the
source 2 dimensioned array. <nElement> is the element position
within each sub-array to copy.
Examples:
---------
Both DBSTRUCT() and DIRECTORY() are good examples.
Each return an array of arrays. DBSTRUCT() for instance, returns
the structure of the current database file in an array whose
length is equal to the number of fields in the database file.
Each element of the array is a subarray containing information
for one field. The subarrays have the following format:
{ fieldname, fieldtype, fieldlength,fielddecimals}
To extract a single dimensioned array of, say, the
field names, you could use A2TOSING() with
A2TOSING(DBSTRUCT(),1). For the field types you would use
A2TOSING(DBSTRUCT(),2), etc.
Here is an example with DIRECTORY()
aDir := DIRECTORY()
aNames := A2TOSING(adir,1)
nWhichFile := mchoice(aNames,10,10,20,20,"Which File?")
Source:
-------
S_AFTYPE.PRG