Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning methods(events) at runtime in VFP5?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00204299
Message ID:
00204500
Vues:
17
>Thanks for the quick response.
>I assume by your reply that the answer is no.
>I guess that I will have to do a work around like what you mentioned. The situation is that there are 10 different fields that I use for measurements, so I have 10 text boxes and corresponding labels. The problem is that there are 6 different types that use only certain measurement fields and they are not consistant about the order in which they appear. What I had done was to assign the controlsource, caption and visible properties based upon what the type is for each record. The problem is that for some of the measurements there needs to be code attached to the lostfocus event of the corresponding control.
>So... If I need to stick with this way of doing things, I need to create identical lostfocus events for the text boxes that test to see what the controlsource is for that text box and carry out the code if need be.
>Thanks,

Hi Derek,
You might want to delegate the LostFocus functionality to the containing form(Bridge pattern). Add a property to your control classes, cWhatAmI and set it to the type of record. Your form class gets a ControlLostFocus method. Have the LostFocus of your controls call the ControlLostFocus method of the parent form and pass the record type information (or a reference to self).
This approach will allow you to put most of the code in the form class.

HTH,
Ned
Ned

Reality is.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform