Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple forms - one data environment
Message
From
06/10/2008 05:14:06
 
 
To
04/10/2008 15:34:11
Scott Malinowski
Arizona Fox Software LLC
Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01352794
Message ID:
01352933
Views:
33
>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
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform