home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
CLIPPER
/
CRLIB3
/
CRLIB.DOC
next >
Wrap
Text File
|
1992-12-26
|
22KB
|
865 lines
CRLIB.DOC - Documentation of the functions contained in CRLIB.LIB
TABLE OF CONTENTS
A. Graphics Functions
DESKTOP()...................................1
VIDEOSET()..................................3
GRCOLR()....................................3
GRBKCOLR()..................................4
PIXL()......................................5
RECTANGL()..................................6
SPHERE()....................................6
PIE().......................................7
CURPOS()....................................8
LINEDRAW()..................................8
GRMOVSCR()..................................9
GRSCR2FI()..................................9
GRFI2SCR().................................10
GRTEXT()...................................11
B. Database Functions.
DBFIX()....................................11
RELPOS()...................................11
SECURDB()..................................12
C. Time and Date functions
GETFTIME().................................13
FTIMEVAR().................................13
SETFTIME().................................14
TIMESTAMP()................................14
D. Miscellaneous Functions.
CRCHECK()..................................15
CURSIZER().................................15
FLOATPT()..................................15
SCR2FIL()..................................16
Page 1
I. CRLIB.DOC - Documentation of the functions contained in CRLIB.LIB
1. Graphics Functions
__________________________
DESKTOP()
Purpose: To create a desktop menu in graphics mode with a special
background shading not available in text mode with most
graphic adapters.
Syntax : DESCKTOP([<expC1>] [,<expC2>] [,..<expCN] [,<arrayA1>] [,<arrayA2>]
[,<...arrayAN>] [,<arrayB1>] [,..arrayBN>] [,<expCx>])
Return : A string corresponding to the chosen main menu and pulldown menu
items.
Note : <expC1..<expCN> are the main menu items passed. The number passed
is constrained by the sum of the number of characters contained in
all of the items plus a needed space between each item. This sum
should not exceed the available horizontal desktop space.
<arrayA1..arrayAN> contain the pulldown window items. <ArrayA1>
corressponds to <expC1>, <arrayA2> to <expC2>, etc.. A maximum of
eleven items per pulldown window is allowed. If no pulldown window
is needed for a main menu item, declare the related array to hold
one item containing the character, 'b' n quotes.
<arrayB1..arrayBN> (optional) contain color settings for the
menu system components. The chart below illustrates the
relationship between the array elements and the color settings.
If no parameter is included note the default colors.
Array Element Menu Component Default Value
------------- -------------- -------------
1 Pixels 11
2 Background 0
3 Bar 1
4 Text 5
5 Window Frame 15
6 Window Background 0
7 Prompt 15
Color Chart
-----------
0 - Black 8 - Dark gray
1 - Blue 9 - Light blue
2 - Green 10 - Light green
3 - Cyan 11 - Light cyan
4 - Red 12 - Light red
5 - Magenta 13 - Light magenta
6 - Brown 14 - Yellow
7 - White 15 - Bright white
Page 2
The last parameter, <ExpCx> (optional) contains any desired copywrite
or status bar message.
Example:
DECLARE ITEM1[1], ITEM2[1], ITEM3[5], ITEM4[3], ITEM5[1], COLR[7]
ITEM1[1] = 'b'
ITEM2[1] = 'b'
ITEM3[1] = 'Inventory List'
ITEM3[2] = 'Sales Quotas'
ITEM3[3] = 'Regional Sales'
ITEM3[4] = 'Sales Per Period'
ITEM3[5] = 'Annual Sales Summary'
ITEM4[1] = 'Reindex'
ITEM4[2] = 'Delete'
ITEM4[3] = 'Archive'
ITEM5[1] = 'b'
COLR[1] = 9
COLR[2] = 0
COLR[3] = 1
COLR[4] = 4
COLR[5] = 14
COLR[6] = 0
COLR[7] = 14
Choice = DESKTOP('Edit','Add','Reports','Utilities','Quit',;
ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,COLR,'Demo Version Only')
DO CASE
CASE Choice == '1'
DO EDIT_PROC
CASE Choice == '31' &&Main menu option 3, pulldown choice 1
DO RPTINV
CASE Choice == '32' &&Main menu option 3, pulldown choice 2
DO RPTQUOTA
.....
.....
Result: Choice will be a concatenated string representing the selected
main menu item plus the pulldown window selection (if any).
Page 3
VIDEOSET()
Purpose : Sets video mode from text to graphics or vice versa.
Syntax : VIDEOSET([<expN>])
Argument: <expN> if set to 1 turns on graphics mode. Set <expN> to
0 to return to text mode.
Note : Clipper can operate in graphics mode, however you cannot
use @..SAY, @..GET, or any screen display commands or
functions unless you are in text mode. You want to go
into graphics mode to use the graphics functions listed
below.
example :
VIDEOSET(1) &&& Turns on graphics mode
SPHERE(x1,y1,x2,y2) &&& Draw a sphere
....
....
....
VIDEOSET(0) &&& Return to text mode
________________
GRCOLR()
Purpose : Sets foreground color in graphics mode.
Syntax : GRCOLR([<expN>])
Argument: <expN> can be set to any of the color values listed
below to achieve the respective color.
Color Chart
-----------
0 - Black 8 - Dark gray
1 - Blue 9 - Light blue
2 - Green 10 - Light green
3 - Cyan 11 - Light cyan
4 - Red 12 - Light red
5 - Magenta 13 - Light magenta
6 - Brown 14 - Yellow
7 - White 15 - Bright white
Page 4
Example:
VIDEOSET(1)
GRCOLR(14) &&Set foreground color to yellow
Returns : Nothing.
______________________
GRBKCOLR()
Purpose : Sets background color in graphics mode.
Syntax : GRBKCOLR([<expN>])
Argument: <expN> can be set to any of the color values listed
in the GRCOLR() section above.
Example:
VIDEOSET(1)
GRCOLR(14) &&Set foreground color to yellow
GRBKCOLR(1) && Set background color to blue
Returns : Nothing.
Note : Clipper can operate in graphics mode, however you cannot
use @..SAY, @..GET, or any screen display commands or
functions unless you are in text mode. You want to go
into graphics mode to use the graphics functions listed
below.
example :
VIDEOSET(1) &&& Turns on graphics mode
SPHERE(x1,y1,x2,y2) &&& Draw a sphere
....
....
....
VIDEOSET(0) &&& Return to text mode
Page 5
PIXL()
Purpose : Draw a single pixl at a specified location.
Syntax : PIXL([<expN1>] [,<expN2>])
Argument: <expN1> and <expN2> are the respective x and y coordinates
in graphics mode.
Note : Since you are in graphics mode you are not limited to
80x25 x and y values. If you are using a monochrome
(Hercules) you are limited to 720 X 348 otherwise, the
limit will be 640 X 350 (16 color).
Example:
STORE 1 to x,y
VIDEOSET(1)
GRCOLR(14) &&Set foreground color to yellow
GRBKCOLR(1) &&Set background color to blue
DO WHILE LASTKEY() <> 27
INKEY(0)
DO CASE
CASE LASTKEY() = 5 &&& Up Arrow
y = y-1
CASE LASTKEY() = 24 &&& Down Arrow
y = y + 1
CASE LASTKEY() = 19 &&& Left Arrow
x = x - 1
CASE LASTKEY() = 4 &&& Right Arrow
x = x + 1
ENDCASE
PIXL(x,y)
ENDDO
Returns : Nothing.
Page 6
RECTANGL()
Purpose : Draw a rectangle with specified coordinates.
Syntax : RECTANGL([<expN1>] [,<expN2>] [,<expN3>] [,<expN4>] [,<expN5>])
Argument: <expN1> if set to 1 will cause the outline of the
rectangle to be drawn only. If <expN1> is set to 2 the
rectangle will be filled with the current foreground
color. <expN2>...<expN5> are the respective x1, y1, x2, and y2
coordinates in graphics mode.
Note : Since you are in graphics mode you are not limited to
80x25 x and y values. If you are using a monochrome
(Hercules) you are limited to 720 X 348 otherwise, the
limit will be 640 X 350 (16 color).
Example:
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
RECTANGL(2,40,20,200,300)
Returns : Nothing.
__________________________
SPHERE()
Purpose : Draw a rectangle with specified coordinates.
Syntax : SPHERE([<expN1>] [,<expN2>] [,<expN3>] [,<expN4>] [,<expN5>])
Argument: <expN1> if set to 1 will cause the outline of the
sphere to be drawn only. If <expN1> is set to 2 the
sphere will be filled with the current foreground
color. <expN2>...<expN5> are the respective x1, y1, x2, and y2
coordinates in graphics mode which define a bounding
rectangle which is also the center of the sphere.
Page 7
Example:
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
SPHERE(2,40,20,200,300)
Returns : Nothing.
__________________________
PIE()
Purpose : Draw a pie with specified coordinates. Useful for
statistical graphical representations.
Syntax : PIE([<expN1>] [,<expN2>] [,<expN3>] [,<expN4>] [,<expN5>]);
[<expN6>] [,<expN7>] [,<expN8>] [,<expN9>]
Argument: <expN1> if set to 1 will cause the outline of the
pie to be drawn only. If <expN1> is set to 2 the
pie will be filled with the current foreground
color. <expN2>...<expN5> are the respective x1, y1, x2, and y2
coordinates in graphics mode which define a bounding
rectangle which is also the center of the pie or arc.
<expN6>..<expN9> are the x3, y3, x4, and y4 coordinates
which define where the arc starts at the intersection of
the vector (x3,y3) and where the arc ends at the intersection
of the vector(x4,y4).
Example:
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
PIE(2,80,50,240,150,240,12,0,150)
Returns : Nothing.
Page 8
CURPOS()
Purpose : Set cursor position in graphics mode.
Syntax : CURPOS([<expN1>] [,<expN2>])]
Argument: <expN1> and <expN2> are the desired x and y coordinates.
Example :
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
CURPOS(80,50)
Returns : Nothing.
__________________________
LINEDRAW()
Purpose : Draw a line from the current cursor position to another
specified point. The line can be diagonal.
Syntax : LINEDRAW([<expN1>] [,<expN2>])]
Argument: <expN1> and <expN2> are the x and y coordinates which define
the end point.
Example :
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
CURPOS(0,0)
LINEDRAW(80,50)
Returns : Nothing.
Page 9
GRMOVSCR()
Purpose : Move portion of screen in graphics mode. Could be used for
animation effects.
Syntax : GRMOVSCR([<Array>] [,<expN1>])] [,<expN2>])
Argument: <Array> contains four elements, the x1,y1,x2,y2 coordinates which
determine the upper left (x1,y1) and the lower right (x2,y2)
corners of the image to be moved. <expN1> and <expN2> are the x
and y coordinates which determine the upper left hand corner of
the destination of the image being moved.
Example :
DECLARE SAVEARRY[4]
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
SAVEARRY[1] = 10
SAVEARRY[2] = 20
SAVEARRY[3] = 50
SAVEARRY[4] = 70
GRMOVSCR(SAVEARRY,80,90)
Returns : Nothing.
__________________________
GRSCR2FI()
Purpose : To save screen in grapics mode to a file.
Syntax : GRSCR2FI([,<expN1>])] [<expN2>] [,<expN3>] [,<expC>])
Argument: <expN1> is the bytes to be written. 65,534 is the maximum.
<expN2> and <expN3> are the x and y values which determine
the size of the screen image to be saved.
Example :
nbytes_ = 60000
savx_ = 640
savy_ = 100
VIDEOSET(1)
GRCOLR(14)
GRBKCOLR(1)
PIE(2,80,50,240,150,240,12,0,150)
GRSCR2FI(nbytes_,savx_,savy_,"FILE.GRA")
Returns : Nothing.
Page 10
GRFI2SCR()
Purpose : To restore a screen previously saved in graphics mode to a file.
Syntax : GRFI2SCR([,<expN1>])] [<expN2>] [,<expN3>] [,<expC>])
Argument: <expN1> is the bytes to be read. 65,534 is the maximum.
<expN2> and <expN3> are the x and y values which determine
the size of the screen image to be restored. The parameters
should be identical to those used to save the file.
Example :
nbytes_ = 60000
savx_ = 640
savy_ = 100
VIDEOSET(1)
GRFI2SCR(nbytes_,savx_,savy_,"FILE.GRA")
Returns : Nothing.
________________
GRTEXT()
Purpose : To create a text window and insert text in graphics mode.
Syntax : GRTEXT([,<expN1>])] [<expN2>] [,<expN3>] [,<expC>])
Argument: <expN1> and <expN2> (or column 1, row 1) is the upper right
hand corner of the text window. <expN3> and the length of the
line of text in <expC> (column 2 and row 2) is the lower right
hand corner of the window.
Example:
VIDEOSET(1)
GRTEXT(1,1,2,"<Shft-F2> Rectangle, <Shft-F3> Sphere")
Page 11
2. Database Functions.
DBFIX()
Syntax: DBFIX([<ExpC>])
Return: Nothing.
Notes : ExpC is a database file name enclosed in quotes. Any
premature EOF markers are extracted. Premature EOF markers
make it impossible to access records after the premature
marker even though we know they are there. This type of
file corruption can occur when turning off a computer while
dBase file are still open.
Example:
CLOSE DATA
DBFIX("BASE2.DBF")
* The database must be closed before it can be used by this
function.
_______________
RELPOS()
Syntax: RELPOS([<expC>] [,<expN1>] [,<expN2>])
Return: The relative position of a record in an index file.
Notes : <expC> is the name of the index file (must be closed)
enclosed in quotes. <expN1> and <expN2 are the start and
ending record, respectively.
Example:
SELECT 0
USE STUDENTS
INDEX ON STR(GRADE,10) + DESEND(STR(GPA,10)) TO STANDNG
APPEND BLANK
&&& Added student in 3rd grade
&&& with GPA of 3.0.
SEEK SeekVar
SeekVar = STR(GRADE_,10)
Start = RECNO() &&& This the start record in the index
&&& file for those students in the 3rd grade.
&&& Lets say RECNO() = 340
SeekVar = SeekVar + STR(DESCEND(GPA_),10)
End = RECNO() &&& This is the record # of the student
&&& we just added. Let's say record 410.
USE &&& The index file MUST BE CLOSED !!!!!!
Page 12
Pos = RELPOS("STANDNG.NTX",Start,End)
?Pos &&& pos = 30.
Result: Record 410 is the 30th record from record 340 in the
index file. That is, the student who is in the third grade
with a GPA of 3.0 is in the 30th position from the start of
the third grade students where the first position would be
that student with a GPA of 4.0.
_____________
SECURDB()
Syntax: SECURDB([<array1>] [,<expL>])
Note..: <array1> is an filled with the names of databases.
expL, if set to .T. will prevent the databases from being opened.
To open them again the function must be called with expL set to
.F. . Setting the expL to .T. removes the '03' in the file
header. This will prevent anyone from opening the file in dBase
or Clipper.
Example:
DECLARE DBFS[3]
DBFS[1] = 'SALES.DBF'
DBFS[2] = 'INVENTRY.DBF'
DBFS[3] = 'RECEIPTS.DBF'
SECURDB(DBFS,.F.) &&& These files can now be opened.
...
...
SECURDB(DBFS,.T.) &&& Now these files cannot be opened.
QUIT
Page 13
3. Time and Date functions
GETFTIME()
Syntax: GETFTIME([<ExpC>])
Purpose : To return the time a file was last modified.
Argument: <expC> is the file name of the file whose last modification date
is sought. The file name must include an extension and must be
enclosed in quotation marks.
Returns : A character string representing a file's last modification date.
The returned string has the form of the following example:
Wed Jan 02 02:03:55 1980.
Example:
timevar = GETFTIME("NAMES.DBF")
?timevar
result: Wed Jan 02 02:03:55 1980.
__________________________
FTIMEVAR()
Syntax: FTIMEVAR([<ExpC>])
Purpose : To return the time a file was last modified to be saved in
a variable which can be then be used with SETFTIME().
Argument: <expC> is the file name of the file whose last modification date is
is sought. The file name must include an extension and must be
enclosed in quotation marks.
Returns : A variable which is to be used with SETFTIME() to change the
modification date and time of a file. See SETFTIME().
Example:
datevar = FTIMEVAR("base2.dbf")
use base2
copy to a:\base2.dbf
SETFTIME(datevar,"base2.dbf")
Page 14
SETFTIME()
Syntax: SETFTIME([<ExpC1>],[<ExpC2>])
Purpose : To reset the date and time a file was last written.
Argument: <ExpC1> is the time and date variable containing the string
returned from FTIMEVAR(). <ExpC2> is the file name whose time and
time and date are being modified. The file name is enclosed in
quotes and the file extension must be included.
Example:
datevar = FTIMEVAR("base2.dbf")
use base2
copy to a:\base2.dbf
SETFTIME(datevar,"base2.dbf")
__________________________
TIMESTAMP()
Syntax : TIMESTAMP([<expC>])
Purpose : To return the time a file was last modified.
Argument: <expC> is the file name of the file whose last modification date is
is sought. The file name must include an extension and must be
enclosed in brackets.
Returns : A character string representing a file's last modification date.
The returned string has the form of the following example:
Wed Jan 02 02:03:55 1980.
Notes : Can be linked with PLINK86.EXE or Microsoft's LINK.EXE, but not
Borland's TLINK.EXE.
Page 15
4. Miscellaneous Functions.
CRCHECK()
Syntax: CRCHECK([<ExpC>])
Return: .T. if memo field or character string contains only CR or LF
characters.
Notes : ExpC is a memo field name. Often a memo field appears empty
although the pressing of the ENTER key may have caused a CR and
LF pair to exist.
Example:
USE NAMES
IF CRCHECK("NOTES")
REPLACE NOTES WITH ""
ENDIF
Result:
If the memo field, NOTES contains only carriage return and line feed pairs
the field can replaced with "" .
__________________________
CURSIZER()
Syntax: CURSIZER([<ExpN1>],[<ExpN2>])
Note..: ExpN1 and ExpN2 are the starting and ending cursor line numbers,
respectively. 12,13 is normal, 0,12 is largest.
Example:
CURSIZER(0,12)
Result:
A tall cursor.
__________________________
FLOATPT()
Syntax: FLOATPT(<Exp1>,<Exp2>)
Return: Floating point remainder of an division problem.
Note..: Exp1 is the dividend and Exp2 is the divisor.
Example:
?floatpt(13,5)
result: The function returns 3.00, the remainder of 12/5.
Page 16
SCR2FIL()
Syntax: SCR2FIL()
Note..: Whenever this function is called, whatever is on the screen
will be saved to a file called SCRNFILE.TXT. The SET KEY
commands in Clipper can be used to set keys to call this function.