INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Classes and Objects

A way to redefine your class and make it a subclass of another class. by ramani
Posted: 5 Dec 02

*********************************************************
** Author : Ramani (Subramanian.G)
*           FoxAcc Software / Winners Software
*           ramani_g@yahoo.com
*  Type   : KB article
*  Warranty : Nothing implied or explicit
*  Last modified : 11 October, 2002
*********************************************************

How to Introduce a Parent Class for your existing class .. or .. change your base class into a subclass of another 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 which is subclassed from FormBase and then make all the other related forms sub-class from this new FormBaseNew.

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.

*********************************************************
* EOF:  ***.PRG
*********************************************************
Evaluate this to make others know how useful is this


Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close