Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to define events code for AddObject controls.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00442646
Message ID:
00442741
Vues:
7
>Is their a method to define events for controls arriving via AddObject, without resorting to a DEFINE CLASS
>oForm.Addobject('Button','CommandButton')
>.. and then -
>oForm.Button.Click=SomeProcedureName()
>or something like this.
>
>It seems that the events are read only outside a class define.
>AHA
>Terry

In addition to what Trey says, you can make some workarounds.

For example, you may add some property to your button class which will store the name of the .PRG file with your SomeProcedure (it may be created at runtime and compiled on the fly). In the Click() event of the class you call:

DO (this.cProcName)

Or, you may use CODEBLOCK utility to execute your custom code (file#9241 "CodeBlock Files (all versions)" in Files section.

In VFP 7 you will be able to use new ExecScript() function for that.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform