Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which method fires ControlSource?
Message
 
 
À
23/06/2016 05:43:34
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01637465
Message ID:
01637610
Vues:
58
>>>>>If user does something, your code reacts to it and assigns the value to this property. You have a choice of bindevent() to the things user may do, or having an _assign method for this property etc. There are ways to avoid having the code in .refresh() doing any checking.
>>>>
>>>>I think I understand what you are saying (although I have not used bindevent() yet). But I am not convinced that having a code in the Refresh() method (the way I did it so far) is going to be a problem in the long run.
>>>
>>>In the long run, it would be a problem only if it runs too long, too often :). Test on slow machines.
>>
>>I used to try to design everything to the lowest common denominator (e.g. slowest computer). And I often ended up having two much code and too much maintenance. And a few customers who still used slow machines didn't really appreciate what I was doing for them.
>>No more Mr. Nice Guy.
>
>Someone had the tagline "Premature optimization is the source of all evil (Donald Knuth)".
>
>>Now I design everything for minimum code maintenance and if someone is having a problem I suggest that they spend some money and buy faster machines. Or add memory. Then they appreciate what I am saying :).
>
>Been through that cycle too, and we're actually on the same side: I've found refresh issues hard to track, easy to forget the reasons (why does the code do this? which problem was this solving?) and thus a drag on maintenance. The simpler the refresh, the less work later.

I never said that I know all the answers and my approach is the best. I am trying it. And if it does not work, or creates some 'side effects', I will go back to see how to make it better. So far I created this code in only ONE method of my look-up control class that I use in many, many forms/windows of the application. But this class is not using 'my' code because I have a property BIND2PK set to .F. by default. And when I do want to bind this control to a PK (in some forms of the application) I need to set this property to .T. and set 6 other properties to some values (e.g. PK field name, Pk field alias, and so on). And then 'my' code in Refresh works. As far as maintenance, I cannot see how I make it simpler. One method and about 10 lines of code; that is all. Performance is another story, and I will "watch" how it works. The good thing about VFP is that 10 lines of code are executed so fast (even on a not-so fast machine) that one never notices.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform