Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple client/server imitation
Message
From
05/03/2004 09:52:14
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00883135
Message ID:
00883456
Views:
7
>Hi Dragan,
>would you like to expand this matter with a sample ?

The simplest way to do this is just a .prg, let's call it setDE.prg (now this will be metacode, not really fully tested code). In each form's .load(),
do setDE with this.dataenvironment
Of course, you can do it at the class level. In case form.load is too late, you may call it from dataenvironment.BeforeOpenTables - "do SetDE with this".
SetDe.prg would be something like this:
lparameters oDE
oDe.AutoOpenTables=.f.
for each oCursor in oDE.objects
   if oCursor.baseclass="Cursor"   && skip relation objects
      if not empty(oCursor.Database)
        oCursor.database= < -- this is where you put your production database name -->
      endif
      if at("\", oCursor.CursorSource)
         oCursor.Cursorsource=forcepath(oCursor.Cursorsource, < -- your path -->)
      endif
   endif
endfor
oDE.opentables()
The names of your database and free tables (if any) can either be manually coded, retrieved from a local ini file or... I think you will manage. The whole reason for this is that in .scx files the full paths to databases and tables are compiled into the code, while in the PEM sheet they are shown as any other paths, so you think they are relative. They are recalculated into relative paths only if the original paths are inaccessible, which you can test by renaming the directory where the original files are.

This was a problem in VFP5, and probably in VFP6 - and I don't know when it was fixed, or whether it was fixed at all. The frameworks I used since were not using DEs in scxes, so I didn't have the pleasure to run into that problem again.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform