Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Naming conventions for custom methods?
Message
De
20/11/2008 17:56:13
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01362229
Message ID:
01363378
Vues:
44
>>Specially handy for Scatter Name objects when you scatter from one table then want to insert into another, having a few fields more, or such objects simulated, when you start with createobject("empty"), then add properties at will and then use that to insert.
>>
>>Again, I don't want to be specific on any cases, uses and situations, and I don't want to answer any of "what do you need that for", because those inevitably lead to discussion over the specifics and individual cases, and the general issue remains unaddressed, like a blank envelope.
>>
>
>I am really having a hard time wrapping my mind around this. To me is a class is something that is thought out, designed carefully, implemented in code, tested -- all that good stuff. The idea of slapping a new property onto it at run time because I'm not sure whether the object already has this characteristic or not is something I don't get at all. Maybe I'm just not imaginative enough.

It must be one of those "like sex" things - once you try it, you can't understand how could you have lived without it before; before you tried it, you couldn't understand what are people talking about :).

OK, nothing so earth-shattering, but it's a nice thing that I've found quite handy in several situations. Imagine that I want to impose new behavior on several controls, few of which I can't even subclass - or there's no need to subclass them for this one time. I'll simply bindevent() their gotfocus and lostfocus, and addproperty() in the first, use it in the second. The code is in only one place, no need to visit or subclass each. The code may, for example, save a few of the old properties into .saveXXX properties and restore them on lostfocus, without writing a single byte to any of the classes - everything is in the binding object.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform