Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Method to an object programatically
Message
 
À
24/04/2007 15:00:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01219499
Message ID:
01219502
Vues:
9
>Is it possible to add or change some methods to the object programatically but in the "define class" section? As it is possible with properties?
>
>Ok, I know I can do this in class definition
>
>
>DEFINE CLASS ...
>   ...
>   PROCEDURE Click
>    ...
>ENDDEFINE
>
>
>but I'd like to add several objects for the same class and later change their properties and also make them different methods.
>
>
>Zlatko.

You could use BINDEVENTS() to bind some events of your object to some custom ones. Somethig like this:
oForm = CREATEOBJECT([MyForm])
oForm.Width  = 800
oForm.Height = 480
oForm.AddObject([Command1],[CommandButton])
oForm.Command1.Visible = .t.
BINDEVENT(oForm.Command1,[Click],oForm,[MyClick],1)
oForm.Show(1)



DEFINE CLASS MyForm AS Form
   Height = 300
   Width  = 300

   PROCEDURE MyClick
      WAIT WINDOW [We are here]
  ENDPROC
ENDDEFINE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform