On 29/01/2019 05:14, Gene Wirchenko wrote:
Hello:
How do I convert a .scx to a .prg?
I have found most of the pieces of code, but I do not see how the contained objects are created. (I was expecting to find a form .Init().)
As others have stated in the past, there are programs that will generate the code from the SCX/SCT files. Some will convert back as well. I use scctextx.prg and it works fine for me. I also have a program I can call and it will automatically generate the code for all screens/vcx class libraries that do not have .txt file or the .txt file is older than the screen.
This is very handy for doing source control so you can see at a glance which screens (forms) have changed. You can then do a diff on the .txt file to see the changes. I then check in the SCX SCT and TXT into source control.
You can get scctextx off the internet:
https://github.com/VFPX/AlternateSCCText/blob/master/SccTextX.prg
Here's the other program, in case you might find it useful.
Peter
* genform.prg
LOCAL tModified,lOlder LOCAL nTextfile PRIVATE cHome LOCAL ARRAY aForms[1],aTxtFile[1] CLEAR cHome = "c:\ws\forms" DO processit WITH 'scx',"K" * then classes cHome = "c:\ws\classes" DO processit WITH 'vcx',"V"
RETURN **************************************** FUNCTION processit PARAMETERS cExt,cLetter LOCAL nForms,i,cForm ? 'Processing: ' + cHome + ' for: ' + cExt * first get a list of forms to process nforms = ADIR(aForms,cHome + '*.'+cExt,'')
FOR i = 1 TO nForms cForm = JUSTSTEM(aForms[i,1]) * now find out if no file or text file older tModified = CTOT(DTOC(aForms[i,3]) + ' ' + aForms[i,4]) lOlder = .t. IF FILE(cHome + cForm + '.txt') nTextfile = ADIR(aTxtFile,cHome + cForm + '.txt','') IF nTextfile > 0 IF tModified < CTOT(DTOC(aTxtFile[1,3]) + ' ' + aTxtFile[1,4]) lOlder = .f. ENDIF ENDIF ENDIF IF lOlder ? 'Generating text file for ' + cForm DO (HOME() + 'scctextx') WITH cHome + cForm + "."+cExt,cLetter,cHome + cForm + ".txt",.t. ENDIF NEXT CLOSE TABLES ALL RETURN
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715
London Office: 101 St. Martin's Lane,London, WC2N 4AZ Tel:0207 299 7960