Tutorials to .com

Tutorials to .com » Database » Foxpro » VFP Chapter Essentials class to create and use

VFP Chapter Essentials class to create and use

Print View , by: iSee ,Total views: 28 ,Word Count: 1463 ,Date: Sat, 18 Apr 2009 Time: 6:06 PM

10.1 ways to create a category of office:

1, Class Designer

2, Form Designer

3, programmatically


Type of design used to create categories using the "Class Designer" to visually create and modify categories. Category is stored in the class library (. VCX) file.

1, to create a new category

Three methods can be used (the File menu, project Manager, CREATE CLASS command) to open the Class Designer and create a new category in which, and in the design will be able to see the final appearance of each object.

These steps: Click the File menu select New → Class → new file in the dialog box gives the name of the new category, the category based on the new and the preservation of the new category into the category of Class → → Designer needed in the base class based on the necessary changes to the closure of → Designer and identify preservation.

2, for the type of design the appearance of the designated

1) for the type of set up a toolbar icon in the Designer category from the category menu, choose Open → Class Information Class Information dialog box, in the tool box icon. BMP file name and path. Note: The toolbar icon. BMP files must be 15 by 16 pixel size. If the picture is too large or too small, it will be adjusted to 15 by 16 pixels, the graphics may be deformed.

2) to set up a container for the category to open category icon designer from the categories menu to select the type of information → icon in the container box, type designer in the form of control on the toolbar button shown. BMP file name and path.

3, create a class library

Three methods can be used to create class libraries.

1) create a class in the new dialog box, type "stored in" box to specify a new class library file.

2) CREATE CLASS command, specify the name of the new library. For example, the following statement creates a new class called myclass and new_lib a new Class Library: CREATE CLASS myclass OF new_lib AS CUSTOM

3) use the command CREATE CLASSLIB. For example, in the command window, type the following command, you can create a new_lib class: CREATE CLASSLIB new_lib

4, to amend the class definition

In the creation of categories, you can modify it, to kind of changes would affect all sub-categories and based on all objects in this category. Can also increase the types of features or modify wrong category, all sub-categories and based on all objects of this class will be modified to inherit. The project manager to select the types of modifications or the use of modified MODIFY CLASS command.

5, the form and save it as a type of control

Can be a form or control on the form save it as a subset of class definition. If you intend to create a sub-category based on the form, or in other forms of re-use of these controls can be a form to save as a class definition.

From the File menu select Save as type → type in the Save As dialog box, select the current selected control or form → in the "class name" box, enter the category name in the paper box → Save the file name type → select the OK button.

10.3 ways to use programming to create window type in the definition of the establishment of a category in the program file (extension. PRG), and then the implementation of the program. For example.

Class 10.4 will be added to the form, the form sets and toolbar

1, sign up for a class library from the Tools menu, select Options → Options dialog box, select the Control tab → select video library and select the Add button in the Open dialog box → select the library to register and select Open → select the OK button.

2, to increase the functional use of sub-class scope operator (::) in the subclass call the parent class code, parent reference methods. Call parent class method syntax is: ParentClass:: Method ()

3, the properties and methods can be added to the category to add new categories as many of the new attributes and new methods. Save a value attribute, and method call can save the process of running the code.

From the category menu to select the new attributes or new methods → Properties dialog box in the new property or method, type the name of → specify whether it protected.

10.5 Class Browser

1, the role of category browser

Can create sub-categories, the type of copy from a library to another library, classes and library files to delete, rename, or redefine the type of category relations. Note: If you want to type to delete, rename, or re-definition of the form are based on the type of operation may not be correct.

2, add a sub-class in the type of browser options open → Library subclass derived from the class, and then select a new category in the new category button → dialog box, enter a new subclass of → in the category defined in Designer and save subclass.

3, the type library from a library copy to the other browser in the category of open source libraries from the Tools menu → type of browser to open the second instance, and select the target in the source library files Library → Select the type of copy, and then hold down the Ctrl key at the same time, the category list at the top of the category icon into the purpose of the class library icon. Hold down the Ctrl key at the same time if it is mobile.

4, the number of categories of documents from one library to another library to copy documents in the class browser to open source class library → If you want to filter the list of categories, the filter box, type in the type of conditions you want to limit from the document → Copy from the category of the Tools menu, open the type of browser the second instance, and select the target document library → library in the source, select the library to copy documents, and then hold down the Ctrl key at the same time, located Class list of the top of the category icon into the target database on the type of icon.

5, delete the category, class or form

1) Open the browser type or form library.

2) In the category list, select the category you want to delete, class or form, and then select the Delete button. On the category, it records in the library marked delete marker, the next you can choose to clear the library; of class libraries and forms, the document is deleted from the disk.

6, rename the class in Class Library

In the class browser to open in the category → Library list, select the category you want to rename, and select Rename Rename button → category in the dialog box, enter the new name, then click Rename. Note: If the relevant sub-class to rename the category, then sub-category name will not be able to invoke heavy inherited class attributes.

7, change the superclass of a class

In the class browser to open in the category → Library list, select the category you want to re-definition, and then select the custom button re-re-definition of → in the dialog box for box, enter the new class name of the Father. New parent and the original parent class must be derived from the same base class → based on box, select or enter the library file name.

8, custom category browser

Type can change your browser's properties, events and methods. Procedures to operate through a browser type:

1) Open the browser category will automatically create a public variable _oBrowser, can use this variable to invoke a browser or operating type form, as the same object to any form.

2) To change the type of browser attributes set.

For example, in the open category of the browser before the adoption of the following command to type the title of the browser property is set to Hello: _OBROWSER.Caption = "Hello" _OBROWSER.Left = 103)

Open the browser type and create a case in point. For example, to open the Class browser, enter the code: DO (_BROWSER)

FoxPro Tutorial Articles

Can't Find What You're Looking For?

Rating: 3.0


No comments posted.