Information générale
Catégorie:
Programmation Orientée Object
You can handle this a few ways. One way I've done this is to include an _assign method on a cStatusMsg property (which could just as easily be a method, if you prefer). I include another property named oStatus, that is normally set to .NULL. Inside the assign method, I check to see if this property evaluates to an object. If it does, I check to make sure it has a method named "SetStatus()", or something along those lines. If it does, I pass the method my error message. The idea is that you instanciate the object and set the oStatus method to a form reference that implements SetStatus(). Now the business object will automatically display some UI (and the two objects aren't tightly coupled). In VFP 8, this kind of thing can be done using BINDEVENT w/o having to include any checks for oStatus (eg. you bind your form method to the "event" method on the business object).
>
>While I almost always use this to pass the message in one direction, you can easily create this kind of hook method to pass messages back to the business object. Just call the form method (if it exists) and grab it's return value. Then act on it.
>
>Hope that helps.
This is interesting. I don't know anything about BINDEVENT, so it looks like I have some reading to do.
Thanks,
Michelle
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement