Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leaving the grid
Message
De
14/12/2007 07:12:39
 
 
À
14/12/2007 06:47:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01275585
Message ID:
01275806
Vues:
7
>One of the grid's columns contains an editbox. When I make changes to the edit box and click anywhere else in the grid all seems to be ok.
>
>However, if I make in change in the edit box and then click the form's save button, the changes do not seem to take place.

>
>You do not say which version of Visual FoxPro you are using. This one sounds like a bug that was around in version 6 but that was fixed in version 7:
>
>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, the focus works between the control and other controls 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 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()
>
Great tip. And if you have many columns, you guess must use
RETURN This.Column1.Text1.Valid() and This.Column2.Text1.Valid() and This.Column3.Text1.Valid() ...
Is there any easy way to make this change in my grid baseclass?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform