>>In the init of the page frame I scatter memvar
>The variables that you create in the INIT of the pageframe are by default Private to that piece of code. Once the Init code finishes, the variables are automatically released.
>
Mark is correct here.
>So, either
>a) PUBLIC the variables - Bad idea.
I agree. Bad idea.
>b) Add properties to the form, scatter the memvars, then copy them to the new form properties. - This is the best MemVar type solution.
High maintenance overhead in the long run.
>c) You could add an array property to the form, scatter the memvars to an array, then ACOPY the scattered array to the Form property array. - A bit long winded and you will have meaningless array references appearing at design time in your form controls (but you get out of having to manually copy the variables).
Also has high maintenance overhead in the long run. Imagine what would happen if you added a new field in the middle somewhere.
My recommendation is to drop the concept of SCATTER MEMVAR entirely. It's not necessary anymore and is redundant to VFP's buffering capabilities. Turn on optimistic buffering, then when the user saves, do a TABLEUPDATE(), otherwise do a TABLEREVERT(). In this way, your controls will be bound directly to the data fields, making long term maintenance easy.
Précédent
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