Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ingrid Problem
Message
De
16/07/1998 15:45:39
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
14/07/1998 23:20:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00116648
Message ID:
00118282
Vues:
26
>>
>> CASE m.nKeyCode=13
>> if gEnterTerminate
>> thisform.release
>> endif
>>
>>Is there a better way to do this? Are there any side effects from changing the Ingrid control in this manner.
>>
>>Thanks for all your help and interest,
>>
>>Alex Shoob
>
>Instead of specifying the action explicitly, you might want to create a new method in the class called ActiononEnter or something and call that method in your CASE statement. That way you can put whatever code you want in that method in different instances of the class, and not have to modify the again class later. Polymorphism in action.

This reminds me of another thread [Coding standards], where George Tasker explicitly stated that jumping out of the loop is a very no-no thing to do. OK. Now we actually must have some method of jumping off the bus, so calling ThisForm.Release actually is a jump out of the form's event loop, right? We call it in the middle of an object's method code.

Hiding the Thisform.Release in the ThisIngrid.ActionOnEnter is equal to jumping out of the loop. Since we must have it anyway (though I'd rather use Esc as the key to trigger it), we've actually just changed the way we write it. We don't jump out of the loop, we call jump out method. I still have a feeling that jumping of the loop wasn't that bad and dirty in the first place. Sure needs to be obvious in the code and well documented, else we're in for some heavy debugging - and finding that ActionOnEnter releases the form is equally hard to discover as is premature end of loop. Should we get back to the Coding Standards over this?

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