Tutorials to .com

Tutorials to .com » Software » Vfp » VFP the secondary development of smart sensors

VFP the secondary development of smart sensors

Print View , by: iSee ,Total views: 20 ,Word Count: 2721 ,Date: Sun, 19 Apr 2009 Time: 1:09 AM

Abstract: This paper presents a built-VFP Editor function and use of smart sensors, smart sensors used for the table structure and function of FOXCODE.DBF. Focuses on the secondary development of smart sensors function method script prepared. In this paper, a number of practical examples.
Keywords: vfp editor smart sensors

1 Introduction Intelligent sensors
VFP version 7.0 began to increase from a very good feature: intelligent sensors (IntelliSense) function. The main features are: (1) enter the initials and the space command, the command will be automatically extended; (2) Enter the function name and left parentheses, after the object name and the point, the system will automatically prompt the corresponding parameters or properties, methods, etc. available. In addition to these and similar other languages other than function, VFP there is a characteristic that it provides for the functions of the secondary development of the user that the script can be used to expand the program to function.
Smart sensors and all the contents of the program are defined in a table, the table file name in the system variables stored _FOXCODE. Modify or expand the contents of this table can be changed on the contents of the smart sensor. On the Tools menu, there is a smart sensor Manager (IntelliSense Manager). Intelligent sensor management's role is to help change the fact table. Of course, directly by hand on the table to edit.
Table 2 FOXCODE structure and usage
Table 2.1 FOXCODE total structure of this form more than a dozen fields, the following paragraphs explain the usefulness of a few keywords:
Type: type, there are c (command), F (function), P (attribute), S (script), O (object), U (user-defined), etc.
Abbrev: intelligent sensors trigger the key word, is also a command or function of the shortest abbreviation
Cmd: fill in the name of the script, on the () in this script were to be recorded in another field Abbrev
Data: Remarks type script stored procedures, or storage of any data
Expanded: to start a command or function's full name
Tip: According to Type of message is different from the meaning of these fields are different, but not necessarily all of the needs of the field do not need to be empty, following a brief uses a combination of different ways:
C or F: Abbrev initials in the store, Expand the storage of the full name, Cmd script name in the optional
S: Abbrev stored script name, Data stored procedure script
U: Abbrev stored words, Cmd storage space in brackets (), the script stored in the Data in direct; or: Cmd script name in the storage, Data stored data, the script is in the definition of another record.
2.2 application of smart sensors simple: the Chinese message command, function, attributes such as type of record system has been defined, although it can be amended, but basically not change too much, after all, the transformation function is limited in this respect will not be described. There is, however, that the work is done, it is carried out on the field finished Tip. VFP from the beginning as a result of 7.0 is no longer a Chinese version, the finished work must be done by themselves, for the smart sensors prompted the Chinese, without modification of the binary file directly modify the Tip field to table, so that Chinese difficult it is simple. Chinese to note that there is a comma delimited as a parameter, not to carry out additions and deletions, or incorrect parameter. If you need content to add a comma, use a comma-wide angle of the Chinese. After this finished, the tips of the Chinese language will become. _FOXCODE As a result of the value of system variables can be changed, therefore, can be of value to change it, choose another table. If the combination of key-activated functions, can set a hotkey for switching the value of _FOXCODE in order to change at any time, the English prompts.
3. User-defined types of use of user-defined types (Type to U) of the record, we can add. Here are some of the methods of scripting.
Script VFP is actually the standard procedure, simply put, is to enter a time in the edit field in the presence Abbrev string, and the space bar to activate the smart sensors, the system on the implementation of the corresponding script, the script return value to replace the contents of input, if the return value is empty, not replacement. Call the script, the system will be introduced to the parameters of an object type FOXCODE, this parameter contains the user input and the corresponding table FOXCODE record many useful information, scripts can access to information. So regardless of whether the object, the first sentence of script must be to receive incoming LPARAMETERS parameters.
4. FOXCODE object's properties
There are many FOXCODE object properties, there is no way. FOXCODE table field with the same name attribute, representing the contents of the corresponding field, in addition there is a useful comparison:
CursorLocaChar: After the implementation of the script, put the text to be selected before and after the special characters, defaults to "~"
DefaultCase: default case, from the Type for the V field of the record the contents of Case
FileName: the file name edit
FullName: the current input of the entire lines of text
Location: the use of the type of editor:
0: the command window, 1: procedures, 8: Menu fragments, 10: Code fragment 12: stored procedures
UserTyped: user input of text, not including the activation key, leading spaces or Tab (can be used in place of FullLine)
valueTip: When valueType for "T" when prompted
valueType: script to deal with the program, L: display a list of items, V: show the value, T: prompt. The general needs of the property assignment in the script, user-defined set of general "V"
5. Examples of analysis in order to be clear, are a few examples and their analysis. Here is an example of the Type for "U", Abbrev order to replace the keywords. "U" type rather with "C" type (command) is activated using the space bar. If the type of method or function is activated with the left bracket, then must use "F" type, and the rest with "U" type similar.
5.1 direct replacement, not a script stored in the Expanded string can be launched, the field length is 26, not more than on the line. And in front of a few characters and do not have the same Abbrev.
5.2 records the achievement of a single script placed directly on the current record of the Data field, stored in the Cmd field empty brackets (). For example: Key words for the DC, the replacement for the DEFINE CLASS statement of the multi-block lines, and finally stop the cursor in the "class" position. Script as follows:
IF oFoxcode.Location # 1 & & window, if not, will remain unchanged
oFoxcode.valuetype = "V" & & this trip necessary

RETURN myvar
Description: (1) if the use of smart sensors Manager, then click the Custom of the Script when, LPARAMETERS his party will be automatically added. (2) TEXT-ENDTEXT between the lines (including blank lines) to return to the contents, replace the "class name" as selected for direct input. If only the cursor position, not selected, then as long as a "~" on the line, the symbol "~" CursorLocaChar attributes from the decision, is variable.
5.3 The definition of a separate script if there are generic script, you can write the script in a separate record for the call the other items. The definition of script: Type to "S", Abbrev stored script name, Data stored script, Cmd is empty. Call: Type to "U", Abbrev stored Keywords, Data storage of data, Cmd store to call the script name (on both sides plus ()). For example: Key words for the SQ and IQ, respectively, to generate SQL statements for SELECT and INSERT, the field generated by the script, if the current table has been opened, use the current table, otherwise you are prompted to open.
Type Abbrev Cmd Data
U SQ (fieldlist) SELECT <> FROM <>
WHERE ~ conditions ~ INTO CURSOR
U IQ (fieldlist) INSERT INTO <> (<>)
value (~<>~)
S fieldlist script

fieldlist script is as follows
oFoxcode.valuetype = "V"
IF EMPTY (DBF ()) & & do not open the table, you are prompted to open the
FieldList = AR (1,1)
FOR I = 2 TO ALEN (AR, 1)
FieldList = FieldList +","+ AR (I, 1)
DbfName = JUSTSTEM (DBF ())
RETURN TEXTMERGE (oFoxCode.Data) & & Direct Replacement DATA contents of two variables in the script description: TEXTMERGE () function can be used to replace the value of a variable one-time expression characters <<>> variables.
6 other systems running in the first FOXCODE.DBF from the installation directory will be a copy of the application data under the WINDOWS directory, and then use it. HOME () directory are the same, a copy of which in the end with a view to prevail _FOXCODE system variables can also be re-instated.
_VFP.EditorOptions Attributes can be set to open or close the smart sensor function, given "lq" Close members of the list can be prompt and fast. Lower case for the closed to open capital.
7. Summing up the smart sensor is only 7.0 Yes, the programming software than any other night, but a powerful beginning, is more significant is that its function is to form the content of FOXCODE.DBF achieved, so that users can modify or add records form smart sensors to increase the function of the system to achieve the purpose of the secondary development, it is any other language will not be achieved.
VFP programming of these characteristics to create a convenient, if full use of its features, can be done effectively. Mentioned procedures and scripts, are in the debug version VFP7.0 success.

Visual FoxPro Tutorial Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.