Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding Method to an object programatically
Message
 
To
24/04/2007 15:00:47
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01219499
Message ID:
01219502
Views:
8
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform