* Filename......: VernDemo.Prg * * Author........: Vernon E. Six, Jr. * 1333 West Campbell Road, #151 * Richardson, Texas 75080 * Ph: (214) 437-7949 - Voice * Ph: (214) 931-2309 - BBS * * Last Update...: Sun 09-23-1990 13:13:21 * * Notice........: Copyright (c) 1989-90 by Vernon E. Six, Jr. * All Rights Reserved World Wide * * Purpose.......: Demonstation program for VERNSIX.LIB INITVERN() && Initialize my library INITHELP() && Open the help files in next work area EXTERNAL HELP && Help the linker find HELP.PRG EXTERNAL MAKEHLP && Help the linker find MAKEHLP.PRG EXTERNAL GETCOORD SET KEY 28 TO HELP && SET KEY 291 TO MAKEHLP && SET KEY 294 TO FAKELOCK && PRIVATE n_cntr, n_top, n_left, n_bottom, n_right ***** * * Draw nice "pretty" screen * ***** TEXTCOLR() CLEAR FOR n_cntr = 0 TO 24 @ n_cntr,00 SAY REPLICATE("°",80) NEXT n_cntr ***** * * I like to indent the GRABSCRN() and PUTSCRN() functions, so I don't forget * to include a PUTSCRN() for every GRABSCRN() * ***** GRABSCRN() _msg[1] = " Vern Six's Clipper ToolBox v4.20 Sun 09-23-1990 " _msg[2] = " " _msg[3] = " Copyright (c) 1990 " _msg[4] = " by Vernon E. Six, Jr. " _msg[5] = " 1333 West Campbell Road, #151 " _msg[6] = " Richardson, Texas 75080 " _msg[7] = " Ph: (214) 437-7949 " _msg[8] = " All Rights Reserved World Wide " DISPMSG(_msg,8,"","") SET CURSOR OFF INKEY(5) PUTSCRN() GRABSCRN() _msg[1] = "Welcome to the Vern Six Clipper Toolbox!! " _msg[2] = " " _msg[3] = "What you are about to see is a demonstration " _msg[4] = "of some of the capabilities made possible via " _msg[5] = "this library. " _msg[6] = " " _msg[7] = "For the most part, you will probably not be " _msg[8] = "able to see much from just using this demo. " _msg[9] = "You should look at and STUDY the source code " _msg[10] = "to really get a feel for what is taking place " _msg[11] = "in this program and how to access VERNSIX.LIB." DISPMSG(_msg,11,"Vern Six's Clipper Toolbox v4.00"," Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[1] = " VERNSIX.LIB comes complete with 29 fully operational " _msg[2] = " functions and procedures that you can add to your " _msg[3] = " Clipper application with very little effort. " _msg[4] = " " _msg[5] = " Each function is described in detail in the file " _msg[6] = " called VERNSIX.DOC. To print this file on your " _msg[7] = " printer, merely issue the following command at the " _msg[8] = " DOS prompt: " _msg[9] = " " _msg[10] = " C> COPY VERNSIX.DOC PRN [Return] " _msg[11] = " " _msg[12] = " In addition to VERNSIX.DOC, a Norton Guides Database " _msg[13] = " has been included (VERNSIX.NG). " DISPMSG(_msg,13,""," Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[1] = "The rest of this demonstration is merely a series of" _msg[2] = "pull-down menus. You can move from one pull-down " _msg[3] = "menu to the other, by the use of the left and right " _msg[4] = "arrow keys. To 'pull a menu down', press [Return]. " _msg[5] = "Once you highlight the function you want to see " _msg[6] = "demonstrated, simply press [Return]. " _msg[7] = " " _msg[8] = "Note: Not all functions can be demonstrated from a " _msg[9] = "'visual perspective'. In these cases, a dialog " _msg[10] = "window will appear to tell you what is taking place." _msg[11] = " " _msg[12] = "Be sure to STUDY VERNDEMO.PRG to see what is taking " _msg[13] = "place behind the scenes. " DISPMSG(_msg,13,"", " Press any key to continue ") INKEY(0) PUTSCRN() ***** * * Open SETUP.DBF for database functional demos * ***** SELECT 0 BEGIN SEQUENCE * Make sure SAMPLE.DBF exists. If it doesn't, then create a new one. IF .NOT. FILE("sample.DBF") CREATE tmpfile IF .NOT. V_USE("tmpfile",.T.) _msg[1] = "Unable to open 'TMPFILE.DBF' exclusively" _msg[2] = " Program aborted! " DISPMSG(_msg,2,"","") INKEY(5) BREAK ENDIF ADD_FLD( "AUTHORLAST", "C", 20, 0) ADD_FLD( "AUTHORFRST", "C", 15, 0) ADD_FLD( "AUTHORMID ", "C", 13, 0) ADD_FLD( "TITLE ", "C", 60, 0) ADD_FLD( "SUBTITLE ", "C", 60, 0) ADD_FLD( "PUBLISHER ", "C", 30, 0) ADD_FLD( "CITYSTATE ", "C", 20, 0) ADD_FLD( "YEAR ", "C", 9, 0) ADD_FLD( "CLASS ", "C", 20, 0) ADD_FLD( "CROSSREF ", "C", 12, 0) ADD_FLD( "LOCATION ", "C", 5, 0) ADD_FLD( "COMMENT1 ", "C", 72, 0) ADD_FLD( "COMMENT2 ", "C", 72, 0) ADD_FLD( "COMMENT3 ", "C", 72, 0) USE CREATE sample FROM tmpfile ERASE tmpfile.dbf ENDIF IF .NOT. V_USE("SAMPLE",.F.) GRABSCRN() _msg[1] = "Could not gain access to 'SAMPLE.DBF'" _msg[2] = " " _msg[3] = " Program aborted! " DISPMSG(_msg,3,""," Press any key to continue ") INKEY(0) PUTSCRN() BREAK ENDIF IF .NOT. FILE("SAMPLE"+INDEXEXT()) n_temp = 0 INDEX ON AUTHORLAST + AUTHORFRST + VINDEX("SAMPLE.NTX",@n_temp) TO SAMPLE USE REMKEY([+ VINDEX("SAMPLE.NTX",@n_temp)],"SAMPLE"+INDEXEXT()) IF .NOT. V_USE("SAMPLE",.F.) GRABSCRN() _msg[1] = "Could not gain access to 'SAMPLE.DBF'" _msg[2] = " " _msg[3] = " Program aborted! " DISPMSG(_msg,3,""," Press any key to continue ") INKEY(0) PUTSCRN() BREAK ENDIF ENDIF SET INDEX TO SAMPLE END SEQUENCE ***** * * Define variables for VMENU() * ***** PRIVATE ac_options[70] && Character array of options PRIVATE an_start[10] && Corresponds to each menu's number of options PRIVATE an_end[10] && "" PRIVATE ac_msgs[70] && Message for bottom of screen FOR n_cntr = 1 TO 70 ac_msgs[n_cntr] = "" NEXT n_cntr ***** * * Define top menu (the one across the top) * ***** an_start[1] = 1 an_end[1] = 6 ac_options[1] = " General " ac_options[2] = " Input/Output " ac_options[3] = " Network " ac_options[4] = " Help " ac_options[5] = " Database " ac_options[6] = " Other " ***** * * First pull-down * ***** an_start[2] = 10 an_end[2] = 11 ac_options[10] = " FSELECT() " ac_options[11] = " INITVERN() " ***** * * Second pull-down * ***** an_start[3] = 15 an_end[3] = 29 ac_options[15] = " ASK() " ac_options[16] = " ASK2() " ac_options[17] = " CENTER() " ac_options[18] = " DISPMSG() " ac_options[19] = " FGBG2N() " ac_options[20] = " GETCOLOR() " ac_options[21] = " GETCOORD " ac_options[22] = " GRABSCRN() " ac_options[23] = " N2FGBG() " ac_options[24] = " PUTSCRN() " ac_options[25] = " SPECTRUM() " ac_options[26] = " TEXTCOLR() " ac_options[27] = " VMENU() " ac_options[28] = " VWIND() " ac_options[29] = " WINDCOLR() " ***** * * Third pull-down * ***** an_start[4] = 35 an_end[4] = 39 ac_options[35] = " FAKELOCK " ac_options[36] = " V_APPEND() " ac_options[37] = " V_FLOCK() " ac_options[38] = " V_RLOCK() " ac_options[39] = " V_USE() " ***** * * Fourth pull-down * ***** an_start[5] = 45 an_end[5] = 47 ac_options[45] = " HELP " ac_options[46] = " INITHELP() " ac_options[47] = " MAKEHLP " ***** * * Fifth pull-down * ***** an_start[6] = 50 an_end[6] = 55 ac_options[50] = " REMKEY() " ac_options[51] = " VEDIT() " ac_options[52] = " VFILT() " ac_options[53] = " VINDEX() " ac_options[54] = " VSCRL() " ac_options[55] = " VSELECT() " ***** * * Sixth pull-down * ***** an_start[7] = 60 an_end[7] = 62 ac_options[60] = " A special thanks... " ac_options[61] = " Ordering Information " ac_options[62] = " Quit " gn_pulldown = 0 gn_option = 0 DO WHILE .T. n_opt = VMENU(ac_options,an_start,an_end,ac_msgs) DO CASE CASE n_opt = 0 SET CURSOR ON EXIT CASE n_opt = 10 && FSELECT() _msg[1] = " FSELECT() allows you to query the user for a " _msg[2] = " filename matching a wildcard specification. The " _msg[3] = " user will be able to move a light bar to the " _msg[4] = " filename that he/she wishes to select. " _msg[5] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[6] = " Select a file from the list on the right. " DISPMSG(_msg,6," FSELECT() ","",5,1) c_choice = FSELECT("*.*",5,60,15,"","") IF .NOT. EMPTY(c_choice) _msg[1] = " You selected " + c_choice DISPMSG(_msg,1,"","") INKEY(3) ENDIF CASE n_opt = 11 && INITVERN() _msg[1] = " INITVERN() initializes the variables used by the " _msg[2] = " various functions in this library as well as sets " _msg[3] = " the colors from the configuration database or creates " _msg[4] = " the configuration database if it doesn't exist. " DISPMSG(_msg,4," INITVERN() "," Press any key to continue ") INKEY(0) CASE n_opt = 15 && ASK() _msg[1] = " ASK() prompts the user with a one line question. " _msg[2] = " ASK() will return a one character response which " _msg[3] = " can be limited to specific characters. ASK() is " _msg[4] = " non-screen destructive. " _msg[5] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[6] = " Press any key to see a demonstration of ASK() " DISPMSG(_msg,6," ASK() ", "") INKEY(0) c_choice = ASK("DEMO: Do you want to continue","YyNn") CASE n_opt = 16 && ASK2() _msg[1] = " ASK2() prompts the user with a multiple line " _msg[2] = " question. ASK2() will return a one character " _msg[3] = " response which can be limited to specific " _msg[4] = " characters. ASK2() is non-screen destructive. " _msg[5] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[6] = " Press any key to see a demonstration of ASK2() " DISPMSG(_msg,6," ASK2() ", "") INKEY(0) _msg[1] = "DEMO: This is line one of the multi-line question" _msg[2] = "DEMO: Do you want to continue" c_choice = ASK2(_msg,2,"","","YyNn") CASE n_opt = 17 && CENTER() _msg[1] = " CENTER() allows you to center a string within a " _msg[2] = " given width. " DISPMSG(_msg,2," CENTER() ", " Press any key to continue ") INKEY(0) CASE n_opt = 18 && DISPMSG() _msg[1] = " Displays a message in a window (centered on the " _msg[2] = " screen). The programmer can supply optional top " _msg[3] = " left coordinates for the window. This message is " _msg[4] = " being displayed by DISPMSG(). " DISPMSG(_msg,4," DISPMSG() " , " Press any key to continue ") INKEY(0) CASE n_opt = 19 && FGBG2N() _msg[1] = " Converts a foreground/background alphabetic color " _msg[2] = " sequence to a numeric color as shown in SPECTRUM() " DISPMSG(_msg,2," FGBG2N() ", " Press any key to continue ") INKEY(0) CASE n_opt = 20 && GETCOLOR() _msg[1] = " Prompts the user for the various color schemes " _msg[2] = " (text and windowed) that he/she wants to use in " _msg[3] = " your program. " _msg[4] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[5] = " Press any key to see a demonstration of GETCOLOR() " DISPMSG(_msg,5," GETCOLOR() ", "") INKEY(0) GETCOLOR() CASE n_opt = 21 && GETCOORD() GRABSCRN() _msg[01] = " Allows the user to size a box on the screen " _msg[02] = " through the use of the cursor control keys. " _msg[03] = " Returns the top,left and bottom,right coordinates " _msg[04] = " to your program. " DISPMSG(_msg,4," GETCOORD() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " When this procedure is called you will see a box " _msg[02] = " appear on the screen (at the starting coordinates " _msg[03] = " you specified). The cursor will be in the upper " _msg[04] = " left hand corner of the box. You may move the " _msg[05] = " corner around the screen by using the cursor " _msg[06] = " control keys. " DISPMSG(_msg,6," GETCOORD() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " If you press the [HOME] key, the cursor will move " _msg[02] = " from the upper left corner of the box to the lower " _msg[03] = " right corner. You can now move this corner of the " _msg[04] = " box around the screen by using the cursor control " _msg[05] = " keys. Pressing the [HOME] key will once again " _msg[06] = " place the cursor in the upper left corner of the " _msg[07] = " box. " _msg[08] = " " _msg[09] = " When the box is the size and is in the location " _msg[10] = " you want, press the [RETURN] key. " _msg[11] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[12] = " Press any key to see a demonstration of GETCOORD() " DISPMSG(_msg,12," GETCOORD() ", "") INKEY(0) n_top = 5 n_left = 10 n_bottom = 20 n_right = 70 DO GETCOORD WITH n_top, n_left, n_bottom, n_right PUTSCRN() CASE n_opt = 22 && GRABSCRN() _msg[01] = " Captures contents of the screen (including cursor " _msg[02] = " location, screen attributes, etc.) to be used in " _msg[03] = " conjunction with PUTSCRN(). " _msg[04] = " " _msg[05] = " Clipper's SAVE SCREEN command doesn't quite fit " _msg[06] = " the bill for most screen save operations. i.e. " _msg[07] = " it doesn't save the cursor position or screen " _msg[08] = " attributes. GRABSCRN() saves all these important " _msg[09] = " aspects of your screen and will restore them " _msg[10] = " properly when you call PUTSCRN(). " DISPMSG(_msg,10," GRABSCRN() ", " Press any key to continue ") INKEY(0) CASE n_opt = 23 && N2FGBG() _msg[01] = " Converts a numeric color to a " _msg[02] = " foreground/background alphabetic color sequence as " _msg[03] = " shown in SPECTRUM() " DISPMSG(_msg,3," N2FGBG() ", " Press any key to continue ") INKEY(0) CASE n_opt = 24 && PUTSCRN() _msg[01] = " Restores a screen captured with GRABSCRN() " DISPMSG(_msg,1," PUTSCRN() ", " Press any key to continue ") INKEY(0) CASE n_opt = 25 && SPECTRUM() _msg[01] = " Displays the complete color spectrum (all possible " _msg[02] = " colors) on the screen with a number representing " _msg[03] = " each. " _msg[04] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[05] = " Press any key to see a demonstration of SPECTRUM() " DISPMSG(_msg,5," SPECTRUM() ", "") INKEY(0) SPECTRUM() INKEY(3) CASE n_opt = 26 && TEXTCOLR() _msg[01] = " Sets color to normal text colors as defined by the " _msg[02] = " configuration database. You can change the colors " _msg[03] = " via the GETCOLOR() function. " DISPMSG(_msg,3," TEXTCOLR() ", " Press any key to continue ") INKEY(0) CASE n_opt = 27 && VMENU() _msg[01] = " Provides the programmer with a very fast and " _msg[02] = " efficient means of producing 'pull-down' menus for " _msg[03] = " their users. VMENU() is screen destructive. " _msg[04] = " " _msg[05] = " The menu use during this demonstration program was " _msg[06] = " created with VMENU(). " DISPMSG(_msg,6," VMENU() ", " Press any key to continue ") INKEY(0) CASE n_opt = 28 && VWIND() _msg[01] = " Draws a window with optional shadow, color and " _msg[02] = " custom box " _msg[03] = " " _msg[04] = " All the windows you see during this demonstration " _msg[05] = " have been created with VWIND(). " DISPMSG(_msg,5," VWIND() ", " Press any key to continue ") INKEY(0) CASE n_opt = 29 && WINDCOLR() _msg[01] = " Sets color to windowed text colors as defined by " _msg[02] = " the configuration database. You can change the " _msg[03] = " colors via the GETCOLOR() function. " DISPMSG(_msg,3," WINDCOLR() ", " Press any key to continue ") INKEY(0) CASE n_opt = 35 && FAKELOCK _msg[01] = " Simulates a global network lock for runtime " _msg[02] = " testing of logic associated with network file " _msg[03] = " operations. " _msg[04] = " " _msg[05] = " FAKELOCK will force all of the Vern Six network " _msg[06] = " functions (V_APPEND(), V_FLOCK(), V_RLOCK(), " _msg[07] = " V_USE()) to act as though they were unsuccessful. " _msg[08] = " This is useful for testing your program code to " _msg[09] = " recover from such failures. " DISPMSG(_msg,9," FAKELOCK ", " Press any key to continue ") INKEY(0) CASE n_opt = 36 && V_APPEND() _msg[01] = " Adds a blank record to the currently selected file " _msg[02] = " or notifies user if unsuccessful. " _msg[03] = " " _msg[04] = " V_APPEND() will try to append a blank record to " _msg[05] = " the currently selected file. If it is " _msg[06] = " unsuccessful, a non-screen destructive message " _msg[07] = " stating 'Waiting for busy network. Press any key " _msg[08] = " to abort.' will appear on the screen and " _msg[09] = " V_APPEND() will continue to endlessly attempt to " _msg[10] = " append a blank record to the currently selected " _msg[11] = " database. If the user aborts the operation by " _msg[12] = " pressing a key, V_APPEND() will return a logical " _msg[13] = " value of false. If V_APPEND() returns a value of " _msg[14] = " false, its your job as the programmer to abort the " _msg[15] = " operation and recover properly. " DISPMSG(_msg,15," V_APPEND() ", " Press any key to continue ",5) INKEY(0) CASE n_opt = 37 && V_FLOCK() _msg[01] = " Locks the currently selected file or notifies the " _msg[02] = " user if unsuccessful. " _msg[03] = " " _msg[04] = " V_FLOCK() will try to lock the currently selected " _msg[05] = " file. If it is unsuccessful, a non-screen " _msg[06] = " destructive message stating 'Waiting for busy " _msg[07] = " network. Press any key to abort.' will appear on " _msg[08] = " the screen and V_FLOCK() will continue to " _msg[09] = " endlessly attempt to lock the currently selected " _msg[10] = " database. If the user aborts the operation by " _msg[11] = " pressing a key, V_FLOCK() will return a logical " _msg[12] = " value of false. If V_FLOCK() returns a value of " _msg[13] = " false, its your job as the programmer to abort the " _msg[14] = " operation and recover properly. " DISPMSG(_msg,14," V_FLOCK() ", " Press any key to continue ",5) INKEY(0) CASE n_opt = 38 && V_RLOCK() _msg[01] = " Locks the currently selected record or notifies " _msg[02] = " the user if unsuccessful. " _msg[03] = " " _msg[04] = " V_RLOCK() will try to lock the currently selected " _msg[05] = " record. If it is unsuccessful, a non-screen " _msg[06] = " destructive message stating 'Waiting for busy " _msg[07] = " network. Press any key to abort.' will appear on " _msg[08] = " the screen and V_RLOCK() will continue to " _msg[09] = " endlessly attempt to lock the currently selected " _msg[10] = " database. If the user aborts the operation by " _msg[11] = " pressing a key, V_RLOCK() will return a logical " _msg[12] = " value of false. If V_RLOCK() returns a value of " _msg[13] = " false, its your job as the programmer to abort the " _msg[14] = " operation and recover properly. " DISPMSG(_msg,14," V_RLOCK() ", " Press any key to continue ",5) INKEY(0) CASE n_opt = 39 && V_USE() _msg[01] = " Opens a file in the current work area or notifies " _msg[02] = " the user if unsuccessful. The file can have an " _msg[03] = " ALIAS specified as well as EXCLUSIVE use set on or " _msg[04] = " off. " DISPMSG(_msg,4," V_USE() ", " Press any key to continue ") INKEY(0) CASE n_opt = 45 && HELP _msg[01] = " HELP provides a non-screen-destructive help screen " _msg[02] = " based on the calling program and variable name. " _msg[03] = " Help screens can be added at any time after the " _msg[04] = " program is compiled, through the use of the " _msg[05] = " MAKEHLP procedure and are fully 'context' " _msg[06] = " sensitive. To see a demo of HELP press F1 at any " _msg[07] = " menu selection. " DISPMSG(_msg,7," HELP ", " Press any key to continue ") INKEY(0) CASE n_opt = 46 && INITHELP() _msg[01] = " This function creates the necessary HELP files " _msg[02] = " (DBF, DBT and N?X) in the next available work " _msg[03] = " area. " DISPMSG(_msg,3," INITHELP() ", " Press any key to continue ") INKEY(0) CASE n_opt = 47 && MAKEHLP GRABSCRN() _msg[01] = " Allows the developer to design a help screen after " _msg[02] = " the application is compiled. " _msg[03] = " " _msg[04] = " When this routine is called, you will see a box " _msg[05] = " appear on the screen. You should size the box " _msg[06] = " using the technique described in GETCOORD. " _msg[07] = " " _msg[08] = " When you have a box that is suitable for your help " _msg[09] = " window, press [RETURN]. At this point you may " _msg[10] = " edit the help text as you wish. When you are " _msg[11] = " done, press Ctrl-W. " DISPMSG(_msg,11," MAKEHLP ", " Press any key to continue ",5) INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " To see a demonstration of MAKEHLP, create a text " _msg[02] = " file called VERNSIX.DVP in the current directory " _msg[03] = " and then press ALT-H while VERNDEMO.EXE is running. " DISPMSG(_msg,3," MAKEHLP ", " Press any key to continue ",5) INKEY(0) PUTSCRN() CASE n_opt = 50 && REMKEY() GRABSCRN() _msg[01] = " Removes the reference to VINDEX() from the " _msg[02] = " specified NTX file. " _msg[03] = " " _msg[04] = " One of the side effects of using VINDEX(), or " _msg[05] = " other routines similiar to it, is that the name of " _msg[06] = " the function is a part of the KEY in the index " _msg[07] = " file's header. The function in the key only " _msg[08] = " returns a NULL byte, the mere fact that it is in " _msg[09] = " the header of the file indiciates that any " _msg[10] = " operation involving the index file will make " _msg[11] = " subsequent calls to the function. This will slow " _msg[12] = " things down. " DISPMSG(_msg,12," REMKEY() ", " Press any key to continue ",5) INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " REMKEY() will remove the reference to the function " _msg[02] = " (VINDEX()) from the NTX file's header so any " _msg[03] = " operation involving the index file will no longer " _msg[04] = " make subsequent calls to the function." DISPMSG(_msg,04," REMKEY() ", " Press any key to continue ") INKEY(0) PUTSCRN() CASE n_opt = 51 && VEDIT() _msg[01] = " Emulates the dBASE III+ 'Edit' command by allowing " _msg[02] = " the user to page back and forth through the " _msg[03] = " database records and optionally editing the " _msg[04] = " selected record. " _msg[05] = " " _msg[06] = " VEDIT() is very useful for working with a 'flat' " _msg[07] = " database. VEDIT() controls all the moving around " _msg[08] = " inside your database and will handle SEEKs based " _msg[09] = " on a pressed key, etc. " _msg[10] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[11] = " Press any key to see a demonstration of VEDIT() " DISPMSG(_msg,11," VEDIT() ", "",5) INKEY(0) DO VEDITDEMO CASE n_opt = 52 && VFILT() GRABSCRN() _msg[01] = " Provides a non-screen-destructive user interface " _msg[02] = " to allow the user to select a list of fields, " _msg[03] = " logical connectives, and comparison constants from " _msg[04] = " pop up light bar windows. " _msg[05] = " " _msg[06] = " VFILT() draws information from the database open " _msg[07] = " in the work area currently selected when it is " _msg[08] = " invoked. " DISPMSG(_msg,8," VFILT() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " VFILT() is designed to provide the uninitiated " _msg[02] = " user with an easy interface to 'filter' " _msg[03] = " specification building. It is database " _msg[04] = " independent and limits the choices available in " _msg[05] = " the light bar menus to those that are applicable " _msg[06] = " to the variable type selected. As the user " _msg[07] = " selects fields, relational operators and " _msg[08] = " comparison constants, the string VFILT() builds is " _msg[09] = " also displayed on the screen. " DISPMSG(_msg,9," VFILT() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " VFILT() alone is not a powerful function but when " _msg[02] = " combined with the macro substitution capabilities " _msg[03] = " of Clipper, the two become very powerful indeed. " _msg[04] = " The string returned by VFILT() is suitable for " _msg[05] = " macro substitution in the SET FILTER TO command as " _msg[06] = " well as in any FOR clause in any Clipper command " _msg[07] = " supporting that clause (such as REPORT, SORT, " _msg[08] = " COPY, LIST, etc..). " DISPMSG(_msg,8," VFILT() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " A demonstration of VFILT() can be found within the " _msg[02] = " VEDIT() demonstration." DISPMSG(_msg,2," VFILT() ", " Press any key to continue ") INKEY(0) PUTSCRN() CASE n_opt = 53 && VINDEX() GRABSCRN() _msg[01] = " Provides the programmer with a non-screen " _msg[02] = " desctructuve 'gas guage' type of chart to show the " _msg[03] = " user what percentage of the index operation is " _msg[04] = " complete. " DISPMSG(_msg,4," VINDEX() ", " Press any key to continue ") INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " One of the biggest disadvantages of Clipper is the " _msg[02] = " inability to show the progress of an index " _msg[03] = " operation. While it can be argued that the hard " _msg[04] = " drive access light is sufficient to tell the user " _msg[05] = " that something is happening, a far greater number " _msg[06] = " of users will argue to the contrary. In fact, " _msg[07] = " several users have been known to turn the machine " _msg[08] = " off while in the middle of a large index " _msg[09] = " operation. VINDEX() provides a user-friendly 'gas " _msg[10] = " gauge' type of display telling the user exactly " _msg[11] = " how things are progressing. " _msg[12] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[13] = " Press any key to see a demonstration of VINDEX() " DISPMSG(_msg,13," VINDEX() ", "",5) INKEY(0) PUTSCRN() n_temp = 0 INDEX ON AUTHORLAST + AUTHORFRST + VINDEX("SAMPLE.NTX",@n_temp) TO SAMPLE USE REMKEY([+ VINDEX("SAMPLE.NTX",@n_temp)],"SAMPLE"+INDEXEXT()) BEGIN SEQUENCE IF .NOT. V_USE("SAMPLE",.F.) GRABSCRN() _msg[1] = "Could not gain access to 'SAMPLE.DBF'" _msg[2] = " " _msg[3] = " Program aborted! " DISPMSG(_msg,3,""," Press any key to continue ") INKEY(0) PUTSCRN() BREAK ENDIF SET INDEX TO SAMPLE END SEQUENCE CASE n_opt = 54 && VSCRL() _msg[01] = " Allows the user to BROWSE through a database " _msg[02] = " (seeing a limited number of fields) and " _msg[03] = " selectively edit records. " _msg[04] = " ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ " _msg[05] = " Press any key to see a demonstration of VSCRL() " DISPMSG(_msg,5," VSCRL() ", "") INKEY(0) DO VSCRLDEMO CASE n_opt = 55 && VSELECT() _msg[01] = " Allows the user to select a record from currently " _msg[02] = " selected database. " DISPMSG(_msg,5," VSELECT() ", "") INKEY(0) DO VSELDEMO CASE n_opt = 60 && Special Thanks _msg[01] = " A special note of thanks is due to my very good " _msg[02] = " friend Frank Grubbs, for his never ending support. " _msg[03] = " If it weren't for Frank's continuing testing and " _msg[04] = " support, this library would have never left my den. " DISPMSG(_msg,4,""," Press any key to continue ") INKEY(0) CASE n_opt = 61 && Ordering Information GRABSCRN() _msg[01] = " If you purchased VERNSIX.LIB directly from FrontLine Software in " _msg[02] = " your own name for $39.95, then your copy is already registered " _msg[03] = " and you will receive all the benefits of registration. You do " _msg[04] = " not need to send in a registration form. " _msg[05] = " " _msg[06] = " If you received VERNSIX.LIB from a 'Users' Group', 'Software " _msg[07] = " Library', 'SIG', 'Bulletin Board', etc. and have paid a small " _msg[08] = " fee (usually either yearly dues or $3.00 to $10.00 per disk) you " _msg[09] = " have NOT acquired a registration. The fee you paid was for the " _msg[10] = " convenience of obtaining the diskette with VERNSIX.LIB on it. " _msg[11] = " The fee does NOT apply to the registration fee. " DISPMSG(_msg,11,""," Press any key to continue ",5) INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " If you received an evaluation copy of VERNSIX.LIB from FrontLine " _msg[02] = " Software for a fee of $5.00, you have NOT acquired a " _msg[03] = " registration. The $5.00 you paid was for the convenience of " _msg[04] = " obtaining the diskette with VERNSIX.LIB on it. However, this " _msg[05] = " $5.00 fee DOES apply toward your registration fee and you may " _msg[06] = " deduct it from the $39.95 fee when you register. " _msg[07] = " " _msg[08] = " You may register your copy by filling out the enclosed form and " _msg[09] = " mailing it to the listed address along with your check or money " _msg[10] = " order for $39.95 (Texas residents add 8% sales tax). " DISPMSG(_msg,10,""," Press any key to continue ",5) INKEY(0) PUTSCRN() GRABSCRN() _msg[01] = " When you register your copy of VERNSIX.LIB, you will receive the " _msg[02] = " latest version without the ten second 'advertisemnet' in it. You " _msg[03] = " will also be granted a royalty free run-time license to use " _msg[04] = " VERNSIX.LIB in any of your applications. " DISPMSG(_msg,4,""," Press any key to continue ") INKEY(0) PUTSCRN() CASE n_opt = 62 && Quit IF ASK("Are you sure? ","YyNn") $ "Yy" SET CURSOR ON TEXTCOLR() CLEAR QUIT ENDIF ENDCASE ENDDO RETURN *** End of main program: VERNDEMO.PRG *************************************** ************************************************ ************************************************ ** ** ** Supporting procedures and functions follow ** ** ** ************************************************ ************************************************ ***************************************************************************** PROCEDURE vscrldemo * Purpose.......: Demonstration of VSCRL() * Last Update...: Mon 09-17-1990 23:32:34 * Syntax........: DO vscrldemo * Pass..........: Nothing * Returns.......: Nothing * PRIVATE c_list, n_retval TEXTCOLR() CLEAR SET FILTER TO DO WHILE .T. c_list = "AUTHORLAST + [ ] + AUTHORFRST + [ ] + SUBSTR(TITLE,1,15)" n_retval = VSCRL(5,5,15,c_list,"SCRLEDIT","","",.T.) DO CASE CASE n_retval = 27 && User pressed EXIT CASE n_retval = 28 && F1 DO HELP WITH "VSCRLDEMO",10,"KEY" CASE n_retval = 291 && ALT-H DO MAKEHLP WITH "VSCRLDEMO",10,"KEY" ENDCASE ENDDO RETURN ** VSCRLDEMO ****************************************************************** ******************************************************************************* PROCEDURE SCRLEDIT * Purpose.......: Editing procedure for VSCRLDEMO * Last Update...: Sat 02-24-1990 09:00:37 * Syntax........: DO SCRLEDIT * Pass..........: Nothing * Returns.......: Nothing * PRIVATE c_temp TEXTCOLR() CLEAR @ 01,00 say [ΥΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΈ] @ 02,00 say [³ Sample Library Database ³] @ 03,00 say [ΖΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ΅] @ 04,00 say [³ About the author... ³] @ 05,00 say [³ Last Name: First Name: ³] @ 06,00 say [³ ³] @ 07,00 say [³ About the book... ³] @ 08,00 say [³ Title: ³] @ 09,00 say [³ Sub-Title: ³] @ 10,00 say [³ ³] @ 11,00 say [³ Publisher: City, St: ³] @ 12,00 say [³ ³] @ 13,00 say [³ Year: Class: Location: ³] @ 14,00 say [³ ³] @ 15,00 say [³ Comments... ³] @ 16,00 say [³ ³] @ 17,00 say [³ ³] @ 18,00 say [³ ³] @ 19,00 say [³ ³] @ 20,00 say [ΖΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ΅] @ 21,00 SAY "³ F1 - Help End - End of line ^T - Del word Del - Del Char ³" @ 22,00 SAY "³ ESC - Abort Edit ^Home - First field ^Y - Del to EOL Ins - Insert ³" @ 23,00 SAY "³ Home - Beg of line ^End - Last field ^U - Ooops PgDn - Save ³" @ 24,00 say [ΤΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΎ] IF RECNO() <= LASTREC() c_temp="Record # "+LTRIM( STR(RECNO()) ) IF DELETED() c_temp=c_temp+[*] ELSE c_temp=c_temp+[ ] ENDIF c_temp=c_temp+" of "+LTRIM( STR(RECCOUNT()) )+" " @ 02,02 SAY c_temp @ 05,14 get AUTHORLAST @ 05,49 get AUTHORFRST @ 05,65 get AUTHORMID @ 08,14 get TITLE @ 09,14 get SUBTITLE @ 11,14 get PUBLISHER @ 11,56 get CITYSTATE @ 13,14 get YEAR @ 13,32 get CLASS @ 13,64 get LOCATION @ 16,04 get COMMENT1 @ 17,04 get COMMENT2 @ 18,04 get COMMENT3 ELSE c_temp = "No records in database" GO BOTTOM SKIP @ 02,02 SAY c_temp ENDIF READ RETURN ** SCRLEDIT ******************************************************************* ******************************************************************************* PROCEDURE vseldemo * Purpose.......: Demonstration of VSELECT() * Last Update...: Thu 03-08-1990 20:10:38 * Syntax........: DO vseldemo * Pass..........: Nothing * Returns.......: Nothing * PRIVATE c_list, n_retval TEXTCOLR() CLEAR SET FILTER TO c_list = "AUTHORLAST + [ ] + AUTHORFRST + [ ] + SUBSTR(TITLE,1,15)" n_retval = VSELECT(5,5,15,c_list,"","",.T.) _msg[1] = "You selected record number "+STR(n_retval) DISPMSG(_msg,1,"","") INKEY(10) RETURN ** VSELDEMO ******************************************************************* FUNCTION ADD_FLD ***** * * Purpose: Add fields to tmpfile * ***** PARAMETERS pc_name, pc_type, pn_len, pn_dec APPEND BLANK REPLACE field_name WITH pc_name, ; field_type WITH pc_type, ; field_len WITH pn_len, ; field_dec WITH pn_dec RETURN(.T.) *** End of function: ADD_FLD() ************************************************ ******************************************************************************* PROCEDURE veditdemo * Purpose.......: Demonstrate VEDIT() use * Last Update...: Thu 03-08-1990 20:06:25 * Syntax........: DO VEDITDEMO * Pass..........: Nothing * Returns.......: Nothing * PRIVATE c_userfilt, n_retval TEXTCOLR() CLEAR c_userfilt = "" SET FILTER TO DO origsamp && Display original screen for VEDIT() (can also && be passed as a parameter) DO WHILE .T. n_retval = VEDIT("VIEWSAMP","EDITSAMP") DO CASE CASE n_retval = 27 && User pressed EXIT CASE n_retval = 28 && F1 DO HELP WITH "VIEWSAMP",10,"KEY" CASE n_retval = 291 && ALT-H DO MAKEHLP WITH "VIEWSAMP",10,"KEY" CASE n_retval = -9 && F10 Change colors GETCOLOR() DO origsamp && Display original screen for VEDIT() CASE n_retval = -8 && F9 Selectively retrieve records c_userfilt = VFILT() IF .NOT. EMPTY(c_userfilt) SET FILTER TO &c_userfilt ELSE SET FILTER TO ENDIF ENDCASE ENDDO SET FILTER TO RETURN ** VEDITDEMO ****************************************************************** ******************************************************************************* PROCEDURE ORIGSAMP * Purpose.......: Draws original screen for VEDIT() * Last Update...: Sat 02-24-1990 09:00:37 * Syntax........: DO ORIGSAMP * Pass..........: Nothing * Returns.......: Nothing * TEXTCOLR() CLEAR @ 01,00 say [ΥΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΈ] @ 02,00 say [³ Sample Library Database ³] @ 03,00 say [ΖΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ΅] @ 04,00 say [³ About the author... ³] @ 05,00 say [³ Last Name: First Name: ³] @ 06,00 say [³ ³] @ 07,00 say [³ About the book... ³] @ 08,00 say [³ Title: ³] @ 09,00 say [³ Sub-Title: ³] @ 10,00 say [³ ³] @ 11,00 say [³ Publisher: City, St: ³] @ 12,00 say [³ ³] @ 13,00 say [³ Year: Class: Location: ³] @ 14,00 say [³ ³] @ 15,00 say [³ Comments... ³] @ 16,00 say [³ ³] @ 17,00 say [³ ³] @ 18,00 say [³ ³] @ 19,00 say [³ ³] @ 20,00 say [ΖΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ΅] @ 21,00 SAY "³ ³" @ 22,00 SAY "³ ³" @ 23,00 SAY "³ ³" @ 24,00 say [ΤΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΎ] CLEAR GETS RETURN ** DISPSAMP ******************************************************************* ******************************************************************************* PROCEDURE VIEWSAMP * Purpose.......: View database fields * Last Update...: Mon 09-17-1990 23:20:24 * Syntax........: DO VIEWSAMP * Pass..........: Nothing * Returns.......: Nothing * TEXTCOLR() @ 02,61 SAY "*** View Mode ***" DO DISPSAMP && Eliminates redudant code @ 21,00 SAY "³ Esc - Exit F10 - Colors Home - First Rtrn - Edit ³" @ 22,00 SAY "³ F1 - Help PgDn - Next End - Last Del - Delete ³" @ 23,00 SAY "³ F9 - Filter Pgup - Previous Alpha - Seek Ins - Append ³" CLEAR GETS RETURN ** VIEWSAMP ******************************************************************* ******************************************************************************* PROCEDURE EDITSAMP * Purpose.......: Edit database fields * Last Update...: Sat 02-24-1990 09:00:37 * Syntax........: DO VIEWSAMP * Pass..........: Nothing * Returns.......: Nothing * TEXTCOLR() @ 02,61 SAY "*** Edit Mode ***" DO DISPSAMP && Eliminates redudant code @ 21,00 SAY "³ F1 - Help End - End of line ^T - Del word Del - Del Char ³" @ 22,00 SAY "³ ESC - Abort Edit ^Home - First field ^Y - Del to EOL Ins - Insert ³" @ 23,00 SAY "³ Home - Beg of line ^End - Last field ^U - Ooops PgDn - Save ³" READ RETURN ** EDITSAMP ******************************************************************* ******************************************************************************* PROCEDURE DISPSAMP * Purpose.......: Common "@ SAY ... GET" routine for VIEWSAMP and EDITSAMP * Last Update...: Sat 02-24-1990 09:00:37 * Syntax........: DO DISPSAMP * Pass..........: Nothing * Returns.......: Nothing * PRIVATE c_temp TEXTCOLR() IF RECNO() <= LASTREC() c_temp="Record # "+LTRIM( STR(RECNO()) ) IF DELETED() c_temp=c_temp+[*] ELSE c_temp=c_temp+[ ] ENDIF c_temp=c_temp+" of "+LTRIM( STR(RECCOUNT()) )+" " @ 02,02 SAY c_temp @ 05,14 get AUTHORLAST @ 05,49 get AUTHORFRST @ 05,65 get AUTHORMID @ 08,14 get TITLE @ 09,14 get SUBTITLE @ 11,14 get PUBLISHER @ 11,56 get CITYSTATE @ 13,14 get YEAR @ 13,32 get CLASS @ 13,64 get LOCATION @ 16,04 get COMMENT1 @ 17,04 get COMMENT2 @ 18,04 get COMMENT3 ELSE c_temp = "No records in database" GO BOTTOM SKIP @ 02,02 SAY c_temp ENDIF RETURN ** DISPSAMP *******************************************************************