Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Occasionally hanging on a table with buffering
Message
De
19/01/2008 10:01:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
18/01/2008 18:39:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01283131
Message ID:
01283227
Vues:
27
>Oh Oh Oh !!!
>
>You know, this never made sense before.
>
>So, turn on buffering when I start, then either post or revert after each record.
>
>That makes a lot of sense! Thanks ...
>
>One last question. When the form closes, which causes the table to close, I don't have to turn off the buffering either?

No need to turn off buffering, either.

However, you should make sure that there are no pending changes. Here is some sample code:
* Form.QueryUnload() - this method asks for permission to close
if not ThisForm.CanChange()
  NoDefault
endif
I am assuming that user-defined method CanSave() returns .T. when it is allowed to go to another record, .F. otherwise:
  • If there are no pending changes, return .T.
  • If there are pending changes, ask the user whether he wants to save. If the user presses "Yes" or "No", it should save (or cancel), and return .T.
  • If the changes can't be saved (violation of some rule), return .F.
  • If the user presses "Cancel", return .F.

    The same method, .CanChange(), will also be invoked before you SKIP to another record, in ThisForm.NextRecord(), etc. - the permission to go to another record or close the form implies that there are no pending changes to the current record.

    Of course, you can change the method names to your liking; these are just examples.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform