General information
Category:
Forms & Form designer
Thanks !! I got ur Zip file also, Haven't tried it yet but going to do it now...
Thanks for your help..
>>>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...
>Hi Vinod,
>Delivered it sometime ago but my mail server posted me a message that you couldn't be reached. Here is a copy :
>#DEFINE nl chr(13)+chr(10)
>cPathChanger = ;
>'cNewDataPath = _screen.comment'+nl+;
>'set path to (cNewDataPath)'+nl+;
>'nDataObjects = amembers(aMyArray,this,2)'+nl+;
>'cOldPath = this.&aMyArray[1]..database'+nl+;
>'cNewDbPath = cNewDataPath+substr(cOldPath,rat("\",cOldPath))'+nl+;
>'for ix = 1 to nDataObjects'+nl+;
>' if this.&aMyArray[ix]..baseclass = "Cursor"'+nl+;
>' this.&aMyArray[ix]..database = cNewDbPath'+nl+;
>' endif'+nl+;
>'endfor'
>=pastemethod("Form","BeforeOpenTables",cPathChanger)
>* Assuming you have a structure like :
>* ..\Appdir\..
>* ..\Appdir\Form && Where forms reside
>* and default working loc is ..\AppDir
>* Put this as many as your form file locations changing the first parm
>
>* If you should maintain extra paths in set path you can change the line in cPathchanger as follows :
>
>*'set path to (cNewDataPath)'+nl+; remove this line add below
>
>*'restore from OriginalPath.mem additive'+nl+;
>*'set path to (cOrgPath+";"+cNewDataPath)' +nl+;
>
>*You can create OriginalPath.mem with cOrgPath holding the needed common paths as either from config.fpw
>* or in main prog entry.
>*In either case
>* cOrgPath = set("path")
>* save to OriginalPath all like cOrgPath
>*would do the job once common paths are set and in one of these common paths you
>*should keep your common tables
>
>function pastemethod
>lparameters cFormFilesLoc, cMethodName, cMethodStr
>* Just to make update on indiviual dirs instead of global all subdirs
>* Call like =pastemethod("Form", "opentables", "set deleted on"+chr(13)+chr(10)...)
>_cliptext = cMethodStr
>set safe off
>=adir(formfiles,cFormFilesLoc+"\*.scx")
>cCheckExistence = "procedure "+lower(cMethodName)
>for fcnt = 1 to alen(formfiles,1)
> use (formfiles[fcnt,1]) alias DECHANGER
> locate for class = "dataenvironment"
> if atc(cCheckExistence,lower(methods)) > 0
> wait window ;
> (formfiles[fcnt,1])+" has already "+cMethodName+" defined ! Check by hand."
> keyboard "{Ctrl+PGDN}" && Open browse edit or call a utility form here - this one was easy for me
> browse fields Methods && Just paste and modi some if needed - saved to cliptext
> else
> replace methods with methods+iif(empty(methods),"",nl)+ ;
> "PROCEDURE "+cMethodName+nl+ ;
> cMethodStr+nl+ ;
> "ENDPROC"
> endif
> use in "DECHANGER"
>endfor
>endfunc
>
>*PROCEDURE BeforeOpenTables
>** These might be useful to add too - These are datasession specific, not global like in old FP -
>*set deleted on
>*set date to dmy
>*set exclusive off
>*ENDPROC
>
>Cetin
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only