Tutorials to .com

Tutorials to .com » Software » Vfp » Using Visual FoxPro 5.0 design data file structure browser

Using Visual FoxPro 5.0 design data file structure browser

Print View , by: iSee ,Total views: 33 ,Word Count: 1066 ,Date: Sat, 18 Apr 2009 Time: 8:38 PM

Procedures used for the design of vfp inevitably involves data tables and freedom of operation itself, for example, any time we need at least know the structure of these data, although these data tables is our own design, but if the file number, a long time, it is entirely possible not remember exactly what, in particular the analysis of someone else's program, this problem is particularly prominent, and we can design a program to solve this problem, because such procedures are not dependent on a specific environment and a strong independence and flexibility, so we need to be designed as a custom class, so use it once and for all:

1. To create a new category to open "File / New ... / category", category called list_stru, derived from "Container" (container), the words "stored in the ..." to select an appropriate directory to save the custom category. and then click "OK." (as shown)

II. List_stru set up a custom attribute type into the following categories of designer, and then set the Container attribute: BackStyle to 0 (transparent), BorderWidth for 2, SpecialEffect for 0 (Au) the
III. Settings display the file name list box object (LIST1)
Add a list called list1 the object, the object to be used to select the data table shows the structure of the file name.
The following method and then set the target of a number of attributes:
(1) RowSourceType = 7 (paper)
That is, the contents of the object from the disk file
(2) RowSource =*. dbf
Show only the suffix of the document known as DBF
(3) the preparation of the project when list1 be selected to take place after the code, which can be achieved through InteractiveChange events:
InteractiveChange Event
Local curpath & & the definition of a variable
curpath = this.list (2) & & return the selected file path
set defa to (curpath) & & specified the default path
if. not .'['$ this.value & & If the selected item is a directory (that is, contains' [ 'character) will not do the following
use (this.value)
this.parent.list2.rowsourcetype = 0
this.parent.list2.clear this.parent.list2.rowsourcetype = 8
this.parent.list2.rowsource = substr (this.value, 1, len (this.value) -4) & & use SUBSTR function to obtain the full file name
this.parent.list2.listindex = 1
Sample plan (design)

Some of the procedures in the following brief description:
A. the LIST attribute RowSourceType object 7 (paper), shows a disk file, as the first letter, the second column for the drive letter and path only, so required this.list (2) to return a complete file path , and then use Set defa to (curpath) to switch to the corresponding path, pay attention to here must be the name of the expression () to enclose curpath, it is equivalent to macro substitution &, the latter use (this.value) are also part of this statement mean
B. In the operation we may have to continue to select the file name and its structure shown in list2, therefore need to constantly update the content of RowSource of list2, this is achieved through this.parent.list2.clear, but clear in the use of methods before RowSourceType attribute must be set to 0 (none), otherwise it is invalid operation, to remove the contents, and then RowSourceType property is set to 8 (structure) can
C. In the RowSourceType property is set, the definition of recycling property RowSource corresponding source file name, substr (this.value, 1, len (this.value) -4) four statements. Add show file structure of the list box object (LIST2 )
Add the list box named LIST2 object, used to display file structure, but do not have to set its properties, because of its RowSource property RowSourceType and has the LIST1 defined InteractiveChange incident.

Finally, we add the appropriate descriptive label objects and other appropriate shape of the interface objects to beautify, preserve, and this category can be used, In addition, the above process a number of relevant documents, including the operation and list box (combo box ) use the key objects, if we can be flexibility in the use of future program design will be of great help

Visual FoxPro Tutorial Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.