Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
>>>>Terry,
>>>>
>>>>>Sure you do. I've always been wary of this, because the grid would be expecting a record source before the cursor of that name had been instantiated. However, given this "safe" method now, and gleaning that the cursor is first created at .Load, I can see how this works.
>>>>
>>>>The main problem with this approach in the past has been the case where you need to pass in a parameter to the form that is needed for the where clause of the query. Getting the parameter in the Init and querying there is too late for the automatic binding to work.
>>>>
>>>>That's why the new BindControls form property was added in VFP8, allowing you to do the querying in the form's Init (with BindControls = .F. in the property sheet), then set BindControls = .T. when the data is ready.
>>>
>>>Load event should have CREATE CURSOR statement making empty cursor, while Init event contains actual query. This way BindControls is not required.
>>
>>An alternative exists. During a called form's .load we can access the calling form. If that form has a parameter object property, the called form can get it. This way we can query immediately without the create cursor. :)
>
>Absolutely, accessing other form properties is better way than sending parameters, especially for modeless form interaction. However, I would put 'query' code to separate form.method, because it will be called from many places; and this indicates that Load should still be limited to creating empty cursor, because 'query' method cannot be called yet.
It only indicates that you can call the query method from the form load after "accessing" the parameter object in the calling form.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement