Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Behaviour
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00766151
Message ID:
00766164
Vues:
22
If I click on any command button on the form -- If Using Mouse
the validation gets fired and focus goes to text1,
but, If I put valid data now, the focus goes to command button.
ideally, It should go on text2 of column2


If I understand you correctly, this is a known bug which has been fixed in VFP 8. This is from Chapter 6 of 1001 Things You Wanted to Know About VFP

Gotcha! Grid's valid fires before the valid of the current control

Notice that when moving from a grid to another object on the form, the grid's Valid fires before the valid of the active cell. This is a bug. Normally you would expect to use the control's Valid method to determine whether that control can lose focus. However, when a control is contained within a grid, there are two levels at which focus operates. First, between the control and other controls that are also within the grid. In this context things behave normally.

Second there is the issue of which form object has focus. This bug will bite you when focus is being moved between the grid and another object. It is, as you would expect, the grid’s Valid method that determines whether the grid can lose focus. However, because the grid’s Valid is called before that of any contained control, a contained control cannot prevent the grid from losing focus even though its own validation has failed.

This can and will allow bad data to be entered into the grid. Fortunately, there is an easy workaround, which ensures that the grid’s Valid explicitly calls and returns the result of any contained control’s validation. So if the text box in the first column of the grid has code in its Valid, this line in the grid's Valid method takes care of the problem:

RETURN This.Column1.Text1.Valid()
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform