Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I want to stay on a field?
Message
 
À
12/09/1997 10:05:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00049609
Message ID:
00049978
Vues:
48
>>>>How do I send the FOCUS back to a field from a VALID?
>>>RETURN .F. or RETURN 0 or RETURN [tabordernextfield of interest]
>>>It's easy to get trapped in WHEN/VALID now so I try to only got/set/lostfocus and use the lostfocus event for validation and repositioning. Usually any gotfocus() code is ok to prime the field for the user (i.e. reset to empty/null/default this.value stuff)
>>>HTH
>>Gary,
>>
>>Here's my take on When/GotFocus and Valid/LostFocus
>>
>> WHEN: Decide if the user should be allowed in this control at all (ONLY This do not set up control here)
>>
>> GOTFOCUS: SEt up control for focus (if this event fires the user is in because they passed the When test)
>>
>> VALID: Decide if the user will allowed to leave this control (Do NOT react to their leaving here)
>>
>> LOSTFOCUS: React to the focus leaving this control (because if this event fires they have passed the Valid test)
>>
>>This is not an either or situation, it is best to make the proper use of all four events. To make proper use one needs to know the event sequence;
>>
>> Moving to a control:
>>
>> WHEN If When test is passed ------> GotFocus
>> If When test failed -------------> When of next control
>>
>>
>> Moving off of a control:
>>
>> VALID If Valid test passed --------> LostFocus
>> If Valid test failed -----------> Focus remains in this control (LostFocus does NOT fire)
>Very good point. I think that a lot of us fall into the OR decision and forget that we can simply flag the state of the control and process in the got/set
>TIA

One thing that may trip you up is that VALID doesn't fire UNLESS there's been a change in the data. If there is bad data in the field when you load the form, you can tab right through the control and your event sequence will skip Valid because VFP is designed to fire Valid only if there's been a change.

Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform