Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple forms - one data environment
Message
De
06/10/2008 17:10:20
 
 
À
06/10/2008 11:59:48
Scott Malinowski
Arizona Fox Software LLC
Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01352794
Message ID:
01353150
Vues:
24
>>>Greetings!
>>>
>>>We are designing what we call a "wizard" in our VFP9 application. The wizard is really a set of processing steps that requires the user to complete each step before we actually save the data.
>>>
>>>We can not use the default data session, since at any given point in time, the user session can have multiple wizards open and processing.
>>>
>>>We have looked at formsets, but what I read about them here on UT, it appears that may be a big mistake. Even though, formsets allow for sharing a single data session, which is what we want for transactional purposes.
>>>
>>>The other option is to have a top level form with a private data session and then to somehow make all forms that are instantiated inside that top level form use the top level form's data session. Any ideas on how to do that?
>>>
>>>Any thoughts or ideas on this issue will be appreciated very much!
>>>
>>>TIA,
>>>
>>>Scott M.
>>
>>Hi Scott
>>
>>I would do it with (data) session object.
>>
>>All code is kept in prg , tables safely oppened and closed, and you can call any number of modal or modeless forms
>>which in return can communicate to each other via underlying session object
>>
>>
>>
>>
>>define class myWizzardSession as session
>>
>>oFirstForm=.f.
>>oSecondForm=.f.
>>oThirdForm=.f.
>>
>>
>>
>>procedure init
>>this.OpenTables()
>>
>>procedure OpenTables
>>use .. 
>>use ..
>>
>>
>>procedure ShowForm1
>>local oForm
>>do form myForm1.scx with this name oForm
>>this.oFirstForm=oForm
>>
>>procedure ShowForm2
>>local oForm
>>do form myForm2.scx with this name oForm
>>this.oSecondForm=oForm
>>
>>
>>procedure ShowForm3
>>local oForm
>>do form myForm3.scx with this name oForm
>>this.oThirdForm=oForm
>> 
>> 
>>
>>procedure DoSomethingOnSecondForm
>>this.oSecondForm.backcolor=rgb(128,128,128)
>>
>>Procedure ShowInterface
>>this.ShowForm1()
>>this.ShowForm2()
>>this.ShowForm3()
>>
>>
>>
>>procedure ReleaseAllForms
>>this.oFirstForm.release()
>>this.oSecondForm.release()
>>this.oThirdForm.release()
>>
>>this.oFirstForm=.f.
>>this.oSecondForm=.f.
>>this.oThirdForm = .f.
>>
>>
>>enddefine
>>
>>
>>**In each Form init (to receive that obj.ref parameter sent by do form command)
>>lParameters oData 
>>this.oData=oData   &&Stash passed reference to underlying session object in form property (added to form class or ad hoc in form)
>>
>>
>>
>>**Anywhere in any of your forms  called this way
>>
>>thisform.oData.DoSomethingOnSecondForm() 
>>
>>
>>
>>
>>
>>
>>To call all this;
>>
>>local oWizzard
>>oWizzard=createobject('myWizzardSession') 
>>oWizzard.ShowInterface()
>>
>>
>>Of course forms have to run in default session.
>>
>>
>>HTH
>>Sergio
>
>Sergio,
>
>Thanks for the information. That makes a lot of sense for sure.
>
>The only thing that concerns me is the default session. Are you saying that all the forms have to use the default session? If so, that will probably not work for our issue.

Hi Scott

Not at all , they don't have to.
I adviced the same session so all forms will see underlying openned tables if that was the idea of putting them into formset at first place, but you can have forms with PS as well. What I decribed is basically scenario to connect multiple forms via underlying object in code. You basically create 'sets of forms' without any downside of 'formsets' ;)

It works quiet good for me, and yes occasionally I invoke forms with private datasessions as well.

Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform