Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Private Data Sessions -- What are they good for
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00300134
Message ID:
00300275
Vues:
27
>>>Now that I have begun to skim the suface on Private Data Sessions, I have a basic questions -
>>>
>>>Why use them at all??
>>
>>Ken-
>>In addition to what all of the others have said, private DS promotes encapsulation in your forms, and forces you to think about parameter passing instead of inter-form dependencies. After you start using private datasessions, you will start to notice that your forms become more transportable- they can be called from anywhere, any number of times, and do not depend on an environment already set up in a calling form. Your forms fend for themselves, because their data environment and record pointers are taken care of inside the form.
>>
>>Peter-
>>If you ever do write your own framework, you should think long and hard before using forms that depend on the default datasession. IMHO, this scheme shows tendencies to do things the FPW 2x way, and not the OO way. Handling things like record pointer coordination should be handled via a forms manager or some other object set up for inter-form communication.
>
>I was having a problem using the default datasession. One form would be used to select a record from a big grid and then open a detail form with the same record. I have several "form pairs" like this. When one particular detail form closed it would generate an error which I can't remember. Someone told me that vfp has a bug in handling the default datasession. Sometimes when a form closes, it stomps on the default datasession, forgetting that it isn't private, or something.

Actually, this sounds more like a problem you might have when using a forms with the default datasession. If you place a table in the DE of a form with the default DS< and then call that form when the table is already open, the form doesn't figure out that the table was already open when it was called, and will close it when it is destroyed. This never happens with Private DS. Using a private DS scheme a main form/lookup form might look like this:

DO FORM GetCustomer TO lnCustomerID
IF !EMPTY(lnCustomerID)
=SEEK(lnCustomerID, "Customer", ID)
ENDIF

The GetCustomer form would locate the customer record and pass back the primary key of the chosen customer. This way, the GetCustomer form can be used anywhere, not just by the Customer form. For example, a function of your program sends a letter to a customer chosen from a list, or adds a customer to a specific buyers category, use the same exact form to choose the customer.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform