VFP edit box method for automatic correction
Abstract: This paper describes using examples of the preparation of vfp application system, through special techniques to achieve the Chinese phrase AutoCorrect function.
Keywords: VFP editing AutoCorrect
We use Word2000 edit a document, can be a tool in Word2000 menu item AutoCorrect feature set, the primary role of this function when a user is editing a document, when the input data is not a correct phrase, the Word2000 will automatically enter the correct phrase is not corrected for the content of the right phrase, thus greatly improving the accuracy of input of Chinese characters. Automatic correction function in the window, the window can be seen, including automatic correction of a mistake is the content of the control data, the use of the process the user can use the system to correct the default data content, but also can increase or modify the contents of a correction data, such In editing the document, the use of this feature is very convenient to use. According to this the realization of the principle, we can use this function to the VFP database management system from the application of the preparation processes, can improve the system in a text editor to write text to deal with the correctness of the time, introduced the author of this text the following automatic the realization of the process of correction function.
In order to achieve the error text is replaced mutual information function can be corrected in accordance with the method of Word2000 to achieve the establishment of a correct manner the contents of the database, the database will be collected in those prone to error when writing the phrase written information. However, we can think of, if collected by the user of the database, by personal knowledge and application of the field restrictions, collected workload will be very great, in practice can not be easy to achieve. In fact, this system can use Word2000 collected in the control of the information is wrong, this part of the transition to the actual needs of the database generated, which would greatly enhance the efficiency of collection. Word2000 so we must first of these is stored in the storage of data error control file to find out, by looking to know the documents folder C: \ Windows \ Application \ Microsoft \ office \, the file name for ms01033.acl, in order not to affect the Word2000 proper use, you can copy this file to the root directory of c and changed the name of the file suffix DOC, into Word2000 document file type, and then use Word2000 to open the document, there are generally prompted to insert the installation disk OFFICE2000, Users can insert the installation disc to install the code content, and then select an appropriate code to open the file, here is the need to select Unicode encoding, and then open the document, you can see the document open in the back part of the existence of all control the misuse of Chinese characters are written materials, this part can copy text out of all the information stored in a plain text file, and to this plain text file named ZL.TXT, in this text file stored Word2000 all the Chinese term correction information, and then this text will require the information to the contents of the conversion to a database, where a small process can make use of such data conversion.
Create a new file named data table ABC.DBF, the data table file includes two fields only NR1, NR2 field for the character, width of 30, after the establishment of this data, the establishment of a program file MAIN.PRG, procedures reads as follows:
WJNR = FILETOSTR ( "C: \ ZL.txt")
WJNR = WJNR + ""
DO WHIL LEN (ALLT (WJNR))> 0
NR11 = SUBS (WJNR, 1, AT ( "", WJNR))
WJNR = SUBS (WJNR, at ( "", WJNR) +2)
NR22 = SUBS (ABC, 1, AT ( "", WJNR))
WJNR = SUBS (ABC, AT ( "", WJNR) +2)
REPL NR1 WITH NR11, NR2 WITH NR22
After running this program to open data sheet ABC.DBF, Word2000, we can see all the characters under the corrected information to the data conversion, in which storage of NR1 in the content of the information is wrong, NR2 is stored information corresponding to the correct content, and then you can take advantage of this data sheet is wrong in the control of the content of documentation to achieve the automatic correction feature.
Specific procedures to achieve
Following a simple example to introduce this feature in the procedure to correct the specific method:
Create a new form, the data in table form to join the ABC data environment, and then placed in the form of a text edit box EDIT1, adjust the edit box to the right location, in the edit box of the data source can be a data table in the Remarks field name, it can be a variable, the user can be in this edit box enter some text, and then in the edit box KEYPRESS events in EDIT1 enter code as follows:
GBWZ = THISFORM.EDIT1.SELSTART & & check the current cursor location
IF GBWZ> 4 & &
THISFORM.LockScreen =. T.
CXNR1 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-7, 8)
CXNR2 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-9, 10)
CXNR3 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-11, 12)
CXNR4 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-13, 14)
CXNR5 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-15, 16)
CXNR6 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-17, 18)
CXNR7 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-19, 20)
CXNR8 = SUBS (THISFORM.EDIT1.VALUE, GBWZ-21, 22)
& & On behalf of the above procedures take 4-11 months before the current cursor to the Chinese characters for different variables, since the data tables generated by the misuse of information is the number of words from 4-11, there is a need to compare, respectively.
LOCA FOR ALLT (CXNR1) = = ALLT (NR1) OR ALLT (CXNR2) = = ALLT (NR1) OR; ALLT (CXNR3) = = ALLT (NR1) OR ALLT (CXNR4) = = ALLT (NR1) OR;
ALLT (CXNR5) = = ALLT (NR1) OR ALLT (CXNR6) = = ALLT (NR1) OR;
ALLT (CXNR7) = = ALLT (NR1) OR ALLT (CXNR8) = = ALLT (NR1)
& & In the database is to find control error IF FOUND () & & if found to operate on the implementation of the replacement of ZDZ = LEN (ALLT (NR1))
THISFORM.EDIT1.VALUE = SUBS (THISFORM.EDIT1.VALUE, 1, GBWZ-ZDZ) +;
ALLT (ABC.NR2) + SUBS (THISFORM.EDIT1.VALUE, GBWZ +1) & & connected to his THISFORM.EDIT1.REFRESH
THISFORM.EDIT1.SELSTART = GBWZ
THISFORM.EDIT1.SELSTART = GBWZ
THISFORM.LockScreen =. F.
All content input has been completed, run the form, and in the form of text edit box when the user enters a wrong phrase data, the contents of the edit box will be automatically corrected for the correct phrase information with the use of Word to use the same, so that we have achieved in the edit box of the AutoCorrect feature of Chinese characters. Of course, in the system can also increase the changes of the corrected data, adding such operation, this system will be more convenient to use.
This article provides a realization of text edit box VFP data errors automatically corrected method, the routine does not consider fault-tolerance, according to this principle can be useful to prepare more complete applications, interested readers can try.
Visual FoxPro Tutorial Articles
- VFP edit box method for automatic correction
- Visual FoxPro 9.0 is more powerful
- Dbf of how to use VFP to SQL Server 7.0 Distributed Query
- VFP the secondary development of smart sensors
- The contents of two databases on the output HTML format methods
- FoxWeb line with the rapid release of your database FOXPRO
- In Chinese and English to achieve VFP5.0 automatically switch
- In VFP to achieve with the combination of variant and an oval frame graphics menu
- Programmed to run through a dial-up network connection
- VFP to achieve in your browser to run the application method
- Visual FoxPro Application for increase in file compression
- Animation of simulation in the VFP
- Using Visual FoxPro 5.0 design data file structure browser
- VFP table tracking method
- In VFP print statements to achieve the specified number of records per page
- Procedures to allow VFP to run in a browser
- Visual FoxPro how to add and remove the network connection
- VFP and SQL SERVER like to do with C / S system
- OK karaoke subtitles colored dynamic display
- In a networked environment using Foxpro database management software developed under the Experience
Can't Find What You're Looking For?
Rating: Not yet rated