Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Utility or way to convert forms to code and back again? 3

Status
Not open for further replies.

dbMark

Programmer
Apr 10, 2003
1,515
US
Problem: We save copies of all changes to our PRG, SCX/SCT, FRX/FRT files. But it is difficult to visually review changes between versions to our forms and form code.

Idea: One of my co-workers realized he can create screen forms and controls in the PRG. He likes that idea because by comparing the PRGs he can clearly see what changes have been made to *all* code from one version to the next. Naturally, I feel that's taking a step backwards since OOP was supposed to make programming easier and more intuitive. It's just that it's easier to see changes that way.

So now we have two camps of thought. Put it all into PRG line by line code that is easy to compare, or keep them in forms and not be sure of every change from one version to the next.

So I wonder, is there a converter that can take the SCX/SCT table and convert it to PRG line-by-line format, and back again?

Or, better yet, is there a good way to compare two sets of SCX/SCT or FRX/FRT form tables and clearly see the differences?
 
You dont need To;

Open the form in Class Browser;
VFP->tools->class browser In files of type select Form... Now you have your Prg.

As Frx's are a table, you can write a program to compare each field in the tables...Its really quite simple

 
Like Imaginecorp said you could use Class Browser to convert Form to code, but you can't convert it back to SCX. BUT when you convert it to code the SCX didn't disappear, so you have both the code and the SCX, when you open the form in the Class Broswer the Last button is View Code, just press it.
You could also check:
or
but I didn't use them so I can't tell you how reliable are they.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
PRG's - Well You know what to do there
FRX's - As mentioned above

SCX's are Tables with SCX extension.
Inside the SCX file is a UniqueID field
Also is a Memo field "METHODS" that holds the code
All you have to do is:
Code:
use c:\xxxxxx\screenname.scx exclu alias OLDVERSION
index on uniqueid tag uniqueid
browse
select 0
use c:\xxxxxx\screenname.scx exclu alias NEWVERSION
set relation to UNIQUEID into oldversion
browse for sys(2007,OLDVERSION.METHOD) <> sys(2007,NEWVERSION.METHOD)
Compare the Method field to your hearts content.
The Sys(2007) is a checksum to the code so only the methods that have been changes will be displayed.

Actually you can use the SYS(2007) on the FRX's also.



David W. Grewe Dave
 
For converting VCX or SCX code to prg you may need to use a better version of Class Browser from CodePlex.

To convert prg back to VCX you may need to search for the late Tom Retting utility Prg2VCX.

You also should use Source control.
 
Thanks everyone, I knew there had to be alternative, I couldn't have been the only one trying this.
 
dbMark,

I can't add to the excellent advice you've already been given. However, you mentioned:

I feel that's taking a step backwards since OOP was supposed to make programming easier and more intuitive.

Creating objects in code is no less OOP-like than using a visual tool. There is nothing at all wrong in using PRGs if the programmer is comfortable doing that, and you shouldn't regard it as step backward.

Personally, I always create non-visual classes in code. I only use the design tool for classes where the physical layout of controls is important.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
In addition to the Class Browser add-in, there's also SCCText.PRG for converting SCX/VCX to code.

Tamar
 
I think the Class Browser was the best six for our needs to compare versions. The SCCText.prg that Tamar mentioned handled many more table types (SCX/VCX/MNX/FRX/LBX) but it appears to be structured around the record order, not as neat and structured as the Class Browser screen form output. Also SCCText parameters indicated conversion from text to tables was possible but both SCX and FRX files had binary file generation errors and failed when I tried.

Thanks everyone!
 
I looked closer at the SCCText code and saw that it has memory variables (defined variables *_SUPPORT) where none allow conversion from text to table and DBC (mentioned above) cannot be converted at all. Either this was written to be part of a larger whole, or some features were coded but never implemented.
 
dbMark,

SCCTEXT was intended to enable two meta tables (forms, class libraries, reports, etc) to be compared and the differences reported. This is different from your requirent, which is to allow a form or class library to be read and reviewed.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thank You. Glad I could help.

Here is a way to compare reports.Change the name of the .Frx (customer_transcations.frx) to one of yours.

Code:
Clear All
Clear
Select 0
Use customer_transcations.frx Alias a
Select 0
Use customer_transcations.frx Again Alias b
nrecno = 0
Select a
Scan
	Store "" To a_cString,b_cString
	nrecno = nrecno + 1
	Select  b
	Goto nrecno
	Select a
	For x = 1 To Fcount()
		a_field = Evaluate("a."+Field(x))
		b_field = Evaluate("b."+Field(x))
		If a_field <> b_field
			a_cString = a_field
			b_cString = b_field
			? Transform(nrecno)
			? "Report A"
			? a_cString
			?"Report B"
			? b_cString
		Endif
	Endfor
	Select a
Endscan
Again, this is to give you an idea on how to do this, you will have to fine tune...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top