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().)
Sincerely,
Gene Wirchenko
I thought all the required info was in the .scx file! Which, of course, opens like a DBF. Funny though, since - a while ago - I did the opposite. I created a special tool to actually turn a PRG into an SCX! Was actually doing it for a job - for an old, VERY OLD Foxbase+ based system, to convert it to a true VFP type system. But, that was a long story...
-K-
On 1/28/2019 9:14 PM, 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().)
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
I have found most of the pieces of code, but I do not see howthe contained objects are created. (I was expecting to find a form .Init().)
Open the Class Browser in VFP from the top menu.
Hit the 'Open' icon on the toolbar.
In the open dialog change the file type to 'Form' and open your SCX.
On the Class Browser toolbar hit the 'View Class Code' button (beside the binoculars). This will open up a .PRG with the code that would programmatically create the form.
On 29-Jan-19 8:46 AM, Alan Bourke wrote:
I have found most of the pieces of code, but I do not see howthe contained objects are created. (I was expecting to find a form .Init().)
Open the Class Browser in VFP from the top menu.
Hit the 'Open' icon on the toolbar.
In the open dialog change the file type to 'Form' and open your SCX.
On the Class Browser toolbar hit the 'View Class Code' button (beside the binoculars). This will open up a .PRG with the code that would programmatically create the form.
iirc the code generated by the Class Browser does not always proper screen-object hierarchy - so the code will not always run without quite a bit of intervention. There was talk of someone re-writing it but afaik that didn't happen.
Fox2Bin is highly recommend for 2 way conversion of VFP binaries to text.
https://github.com/fdbozzo/foxbin2prg
--
rk
-----Original Message----- From: ProfoxTech profoxtech-bounces@leafe.com On Behalf Of Gene Wirchenko Sent: Tuesday, January 29, 2019 12:14 AM To: profoxtech@leafe.com Subject: Converting .scx to .prg
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().)
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
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
Hi Gene,
When I made FoxBin2Prg, the main reason to do it was to generate prg-like code with the maximum possible prg compatibility, but allowing the reverse convertion with a valid binary again, so this imposed some constraints in the way that value assignments are made to preserve the original assignment.
Rigth now, if you generate a prg from a scx file, the only adjustment you need to make, AFAIR, is in the property assignments, because they are in a format like:
Property = string
And not in the proper prg format, that is:
Property = "string"
I did it this way because there are like 4 different ways of assigning properties, and in any case the value must preserve a format that is needed to differentiate between these possibilities:
- default blank property value - default property value when you press enter on it's value - normal user assigned value - user assigned function (like when using "=value" in the property value, with the equal sign)
So, if checking/correcting those values and adding the missing quotes is not a problem for you, the other 99% of the generated code is pure prg that follows the prg rules and syntax.
Hope it helps,
Fernando D. Bozzo
El mar., 29 ene. 2019 6:59, Gene Wirchenko genew@telus.net escribió:
Hello:
How do I convert a .scx to a .prg? I have found most of the pieces of code, but I do not see howthe contained objects are created. (I was expecting to find a form .Init().)
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]