Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question Abt. Data Environment
Message
De
25/12/1997 07:43:15
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
 
 
À
25/12/1997 07:17:15
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00067659
Message ID:
00067924
Vues:
26
>>>>
>>>>Thanks for your reply !!! Your suggestion is very useful...
>>>>
>>>>But I'm facing few problems in setting it up...
>>>>
>>>>If I just set the path to my season dir.. it opens file from the dir. where I'm developing the application...
>>>>
>>>>I guess this is because the thisform.dataenvironment.cursor1.database value is set to my application development dir...
>>>>
>>>>Now what I'm doing is Opening the form with Autoopentables=.f.
>>>>
>>>>In the load method of form, I'm setting the value of
>>>>
>>>>thisform.dataenvironment.cursor1.database=myseasondir
>>>>
>>>>& then running Opentables...
>>>>
>>>>Pls tell me :-
>>>>
>>>>1. Am I doing it right way or is there any shortcut..
>>>>2. If my method is right, Is there any generic routine which can loop through all the cursors and set the value...
>>>>3. How I should handle Tables which are common that means dbfs which are having common value for the software.. like setup.dbf..
>>>>
>>>>Pls help...
>>>Hi,
>>>This is a simple example for a generic form loader in your case. I think this is simplier to apply.
>>>To apply it easily you could write this small prg and run it during form design.
>>>**
>>>* Form design mode - to change code in beforeopentables in DE
>>>*
>>>#define nl chr(13)
>>>cPathChanger = "cNewDataPath = _screen.comment"+nl+ ;
>>> ... && See below
>>>=aselobj(myArray,2) && Get a reference to DE
>>>myArray[1].writemethod("BeforeOpenTables",cPathChanger)
>>>
>>>
>>>* Dataenvironment.beforeopentables
>>>cNewDataPath = _screen.comment && or wherever stored
>>>set path to (cNewDataPath)
>>>nDataObjects = amembers(aMyArray,this,2)
>>>cOldPath = this.&aMyArray[1]..database
>>>cNewDbPath = cNewDataPath+substr(cOldPath,rat("\",cOldPath))
>>>for ix = 1 to nDataObjects
>>> if this.&aMyArray[ix]..baseclass = "Cursor"
>>> this.&aMyArray[ix]..database = cNewDbPath
>>> endif
>>>endfor
>>>
>>>Here is a way to change path at runtime using above :
>>>
>>>*Method processing user data path && Likely to be called instead of do form
>>>lparameters cNewDataPath, fForm
>>>_screen.comment=cNewDataPath && Instead of pub var - if !used to store something else like form instances
>>>do form (fForm)
>>>Cetin
>>
>>
>>Thanks a Lot !! Your suggestion is very good and its working fine..
>>
>>But it took me some time to understand it completely !!
>>
>>I'm using ur code with some modifications but Still One thing I wanted to ask you:-
>>
>>what this piece of code will do :-
>>
>>>* Form design mode - to change code in beforeopentables in DE
>>>*
>>>#define nl chr(13)
>>>cPathChanger = "cNewDataPath = _screen.comment"+nl+ ;
>>> ... && See below
>>>=aselobj(myArray,2) && Get a reference to DE
>>>myArray[1].writemethod("BeforeOpenTables",cPathChanger)
>>>
>>
>>Can u pls Explain me..
>Hi,
>It's just for a builder instead of opening every DE and pasting the method.
>Create it as a custom class by setting the cPathChanger as a string representation of the method than in builder.dbf add an entry with type Form pointing to it (ie: set classlib, classname, description etc. in builder.dbf).
>If you are going to make it a builder add three placeholder params (builder.app needs them).
>When you right click on form in designer and select builder you can call this to write the code to DE.beforeopentables.
>Another -maybe easier and faster- method is to write a prg that will browse through all scx files in the project and add this method to DE class. If you need this I can send you a ready routine, just change the cMethodStr part.
>Cetin


After reading ur code, I realise how Less I know VFP....

Thank you very much... Can you pls send me your ready routine also, I have lot of forms & this way I can save my lot of time...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform