Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to redefine your class ?

Status
Not open for further replies.

ramani

Programmer
Mar 15, 2001
4,336
AE
How to Introduce a Parent Class ...

Time and again, we find the need to introduce, a class of our own which we feel should become a parent for many of the other classes.

For example, take the forms...
Some programmers who are new to VFP, create applications without subclassing the Base Classes and so each of the forms is based on the VFPs FormBase.

Then the need arises to introduce a common functionality to all the forms created.. or a group of forms.

So what we have to do is introduce a FormBaseNew Subclassed from FormBase and then make all the other related forms sub-class from this new FormBase.

The way to do is...

Open The Project
Select Classes Tab
Create a new class .. Example.. a FormBaseNew based on the FormBase class.

Then.. Choose from the VFP Menu .. Tools..

Click on Class Browser..
Click OPEN (OPEN ICON)...
SELECT THE CLASS (.vcx) file required to be modified and open it

Then.. in the result window..
SELECT any of the Forms which need to be redefined...
Then Click on REDEFINE icon on that window...
Select the FormBaseNew as the class and proceed as it guides...



You will notice that the classes are refined and the Selected form become the child of the FormBaseNew

Repeat the steps for all the forms which need to be modified so...

The same method can be used to modify the classes of other types..

Remember to backup the project before doing any of these class modifications, or else, you could end up in trouble if some wrong clickings were made by you.


Best of Luck !
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hi!

I know this feature from the VFP5 Class browser.
Another nice thing you can do is to edit the VCX or SCX file as a pure VFP DBF file in a browse window. Change anything you want, include change the parent class, base class etc etc. You can define that way, for example, a header class that is available to drop into the grid columns visually. Remember, however, to backup you VCX often for case something spoiled. In addition, after each manual change in VCX, recompile it by COMPILE CLASS or COMPILE FORM commands.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top