Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create a method programaticaly
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00129153
Message ID:
00129176
Vues:
25
Hi Mauricio:

In order to programmatically create a Method, you must programmatically create the class as well. The following is a programmatically created subclass of VFP's Cursor base class.

Notice that this class, named CCursor, has three methods, Init(), Release() and GetDefaultDatabase(). To answer your question, you use the FUNCTION ENDFUNC structure to programmatically create your method.

If you designed your class using the Visual Class Designer, there are several ways to create a method. One is to use the VFP menu, with your new class in the design window, click on the Class menu pad. From the ensuing popup, select the New Method bar. In the new method dialog, enter the name of the new method and press the Add button.

Example of a programmatically defined class definition named CCursor.

DEFINE CLASS CCursor AS Cursor

BufferModeOverride = DB_BUFOPTRECORD
Database = ""
Filter = ""
NoDataOnLoad = .F.
Order = ""
ReadOnly = .F.

*--------------
FUNCTION Init()
*--------------
IF IsAbstract(this.Class, "CCursor")
RETURN .F.
ENDIF

THIS.Database = this.GetDefaultDatabase()

IF EMPTY(this.Database)
RETURN .F.
ENDIF

ENDFUNC

*-----------------
FUNCTION Release()
*-----------------
RELEASE this
ENDFUNC

*----------------------------
FUNCTION GetDefaultDatabase()
*----------------------------
RETURN this.Parent.cDefaultDatabase
ENDFUNC

ENDDEFINE


>Hi all,
>
>How do I to create a method programaticaly.
>Write method do not create a method.
>
>
>Thank You,
>
>Mauricio Mesa.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform