Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

VcxEditor Article
Rock Legendre, January 1, 2001
The idea of VcxEditor was borned when I was reading an article of Chin Bae in FoxPro Advisor (April 1997) on how to create visual header and cursor subclasses. I suggest you to read this article because it was very useful for me and I think that it is a good starting point. VcxEditor is a tool t...
The idea of VcxEditor was borned when I was reading an article of Chin Bae in FoxPro Advisor (April 1997) on how to create visual header and cursor subclasses. I suggest you to read this article because it was very useful for me and I think that it is a good starting point.

VcxEditor is a tool that let you play with class libraries and forms more like a table instead of "designing interface" that's the reason why it's a little bit more difficult to start with but it allow you full control on the content of class libraries and forms and that is what is very important for the developers. VcxEditor was not build to replace VFP editor or Class Browser. It allows you play inside the class library to give more flexibility and power for making something you can do with VFP editor like subclassing Header, Cursor, Dataenvironment.

Because VcxEditor was build for developpers and not for god it makes a backup of each class library or form before every session so you can come back if it's necessary.

The reason why VcxEditor can play with a form and class library is because these have the same structure. In the rest of this text I will just talk about Class Library(CL). I will start with the general structure of a CL and after I will explain in more details the fields of the table. CL is a FoxPro standard table but the information in it is not used like a general way (uniquekey, index, joinkey ...) Record Way it uses more like a Sequential Way. In the CL you get a header record to specify if it is a class library or a form and this record is always the first one. Each class in the CL has it's own header record, footer record and the content records between them.

Class Library Header Record
Class A Header Record
Class A Contain Record 1
Class A Contain Record 2
...
Class A Footer Record
Class B Header Record
Class B Contain Record 1
Class B Contain Record 2
...
Class B Footer Record
...

I will explain a little bit more the important structure fields. But this information does not come from Microsoft. It comes from me with my try and my error so it's possible that it's not always the 100% through.

PLATFORM Field

This field represents the platform of the class; generally it's "WINDOWS" or "COMMENT" but probably it can thing like "DOS" or "MACINTOSH"

UNIQUEID Field

This field contains a unique code except for the class footer record it's contain generally the code ("RESERVED")

TIMESTAMP Field

This is a date and time representation of the last modification.

CLASS Field

This field is for the parent class name of the class

CLASSLOC Field

This field is for the filename of the class library coming from the parent class. In general you don't have the path with the filename

BASECLASS Field

This field contains the baseclass name for this class. The baseclass will always be a VFP baseclass.

OBJNAME Field

This one is for the name of the class.

PARENT Field

This field is not for the parent class. It's for an internal use. It's used to detect if a class is contained in another one. For example, if you have a button class(cbutton) in a form class(cform) definition, the button class parent field will contain the name of the form class definition ("cform").

PROPERTIES Field

This field is to affect some none default value to the property of the class. There you can change value of the property and this is good for your own defined property

PROTECTED Field

This field contains the name of protected property

METHODS Field

This field contains all code your write in the method and event for this class

OBJCODE Field

This field contains the compile code find in Method field.

OLE Field
OLE2 Field

RESERVED1 Field

This field contains the key word ("CLASS") when it's a class header record

RESERVED2 Field

This field contains the number of contain record for this class + 1

RESERVED3 Field

This field is to define the user defined property, method and array. I make a deference between array and property in general because VFP did.

  • When it's for property, add the name of this property EX: myproperty
  • When it's for method, add the name of method preceded by a "*" EX: *mymethod
  • When it's for an array property, add the array name with is dimension preceded by a "^" EX: ^myarray(1,3)
After each property, method or array, you can add a description with a space and the description without enter.

RESERVED4 Field RESERVED5 Field RESERVED6 Field RESERVED7 Field RESERVED8 Field USER Field

For the other fields, I don't know what it really does. So, I prefer to not specify something in case it is wrong. VcxEditor features takes care of a majority of this information so you don't have to remember all these but VcxEditor is not built to hide this information from you so all caption and title of fields in VcxEditor keep it's own name field. After you understand what fields do, you will better understand the interface of VcxEditor.

VcxEditor is not a program, it's a class definition call "CEDITOR" in the class library VcxEditor.vcx. The reason why I did this like that, it's because people can subclass it and add some features on it and in this way they will able to benefit of my future upgrade or bug correction.

Because VcxEditor is a class definition, if you want to run it, you have to create an instance of it.

EX:

SET CLASSLIB TO VCXEDITOR.VCX ADDITIVE X = CREATEOBJECT("CEDITOR")

The first thing VcxEditor does is to ask for a CL name with a open dialog box. After that, it shows you a screen with all the class definitions.

In this part, I will try to explain a little bit more the interface but the better way to learn VcxEditor is to try it, make error and try again with some testing class library.

At the bottom of the screen you can see a grid of the CL. With This grid allow you to see what you want directly like a table. On this form you got a pageframe with 2 pages. One with field you generally need and another with method field for write code and reserved3 field to add your own property or method. The combobox allow you to make a filter on the records in the CL grid. With the combobox, you can select a specific class in the CL and only the records for this class will be shown in the grid. In the top of the screen, you can see some command buttons.


This one is to create a new class library.


This button opens another class library. Note that only one class library at the time is allowed.


This is to recompile the class library. Recompiling the class library is very important whenever you make a change to the code in methods or events. It's so important that when you quit VcxEditor, it will ask you to recompile.


Another important thing is to pack the class library. This button let you do this. In VFP, when you modify a class, it does not modify the old record. It deletes the entire class and insert a total new one with the modifications you did. So, if you don't pack the class library, it can grow fast and will make it run slow. Some people says that when you build the project with the option rebuild all, VFP packs all class libraries but I didn't verify this information.

If the table contains deleted records, some features of VcxEditor may not work properly so when you delete records, I recommend you to pack the CL.


With this button, you can call the VFP standard editor to modify a class. One important thing, you must be on a header class record to use this feature. If not, it won't anything and you will have to be on the visual class (for VFP) to use it.


This button shows up a dialog box that help you to add a class definition in the CL.


This one shows up a dialog box that help you add a property, method or array in a class definition. You have to be on a header class record for this feature.


This button adds a blank record at the end of the CL.


This button lets you add a "contain record" in a Class definition but it lets the field empty (Class,Classloc,baseclass,properties...). After, you just have to fill in the blanks to create a sub class.

The record is added in the table right where the current record is. So, select the record where you want to add the new record before selecting this feature.

EX: add a button in a form or a cursor in a dataenvironment class


This one makes a full duplicate of the current record in the table but it makes no adjustment of fields like the option before. So, you have to change the field "RECERVED2" of the header record for a good value.


These buttons make a push and pop record in memory.


These ones are for navigation.


If you are on a header record, this button brings up a help window of the class definition you are on. In this help window, you can find all properties for this class. This feature works only if you installed foxhelp.dbf when you installed VFP.

I think that I made a good overview of VcxEditor features. I hope this document will help you with VcxEditor and I wish you a lot of pleasure to use VcxEditor.

All comments and propositions on VcxEditor will be appreciated

Rock Legendre, WX3data
Rock Legendre, an independent consultant located in the Drummondville area, specializes in system integration and the development of Windows and Web supported database transactional applications. He has successfully developed various types of applications in finance, the automobile industry, Web services, COM objects and B2B systems. Specialized in Microsoft products, he masters a variety of tools, such as Microsoft Visual FoxPro, Microsoft SQL Server and Microsoft Visual Studio .Net (C#). Rock is vice-president of Montreal FoxPro User’s Group (MFUG) and webmaster of SQL Server Montreal Users’ Group (SSMUG).