Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Envrionment Quirks & Slow Opening Forms
Message
 
To
22/10/2004 02:54:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00953449
Message ID:
00953779
Views:
17
Hi Srdjan,

Rather than rewriting the Data Environment each time the form is called, I've chosen to set (via direct editing of the SCX) the DataBase Property to a global variable: (gcDBC) - Please note that you need to use the parenthesis, which I set in my development environment and in the Application. As long as gcDBC points to a valid location, you can both run and edit forms. Ultimately, I may look into using a Data Environment class instead.



Marshal


>>Hi all,
>>
>>I just installed an application which starts in a C:\VFP folder and has a Global Variable set to the app's DBC path. I was shocked to see that Forms with Data Environments were opening VERY slowly.
>>
>>
>>Since I've had various other systems up for years and never heard of this problem I wonder if all my other clients have a D drive mapped to a non-removable device or always have a CD in their D Drive.
>>
>>I am considering making Form modifications suggested in previous threads which use code similar to Doug Hennig's SetDataDirectory.
>>
>
>
>Hi There :)
>Here is one old solutions for old known problem of hardcoded
>database path in dataenvironment cursors.
>
>You create public object based on this class and then just
>add one line of code in each form DE.beforeopentables method.
>
>It will change all database properties of de cursors at run
>time according to setup provided in this object.
>
>
>
>
>define class redirect_dataenvironment as custom
>
>DataPath='C:\yourdatapath'
>
>*** If u use more then one database/directory then
>*** u shld develop this method to respond correctly.
>
>    procedure get_database
>        lparameters cDatabaseName
>        local cDatabaseName
>        return addbs(this.DataPath) + cDatabaseName
>
>
>    procedure redirect_de
>        lparameters oDataEnvironment
>        local i,j,db_name,arr_obj(1)
>        amembers(arr_obj,oDataEnvironment,2)
>        for i = 1 to alen(arr_obj)
>            j = oDataEnvironment.&arr_obj(i) .baseclass
>            if upper(alltrim(j)) = 'CURSOR'
>                db_name=upper(justfname(allt(oDataEnvironment.&arr_obj(i) .database )))
>                oDataEnvironment.&arr_obj(i) .database=this.get_database(allt(db_name))
>                if !file(oDataEnvironment.&arr_obj(i) .database)
>                    messagebox('['+oDataEnvironment.&arr_obj(i) .database+']'+chr(13)+;
>                        'Not found Check your data')
>                endif
>            endif
>        endfor
>
>
>enddefine
>
>
>
>
>So somewhere at the startup of application you create public object
>
>
>Public oData
>oData=createobject('redirect_dataenvironment')
>
>
>and then in each form's de you add folowing line in BeforeOpenTables
>method
>
>
>***BeforeOpenTables
>
>oData.redirect_de(this)
>
>
>
>
>Solution hv to be upgraded to support free tables if you use them.
>
>
>Best Regards
>Sergio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform