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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Class Browser with DataEnvironment 2

Status
Not open for further replies.

umarcon

Programmer
Mar 27, 2024
2
BR
Hi all,

here at my company, we use forms with CursorAdapters created using DataEnvironment.

When we try to convert the form in PRG file using Class Browser, all the information created via DataEnvironment is not contemplated in the PRG.

Is there a way to make this information inserted in this PRG file?

If it is not possible to be done using Class Browser, is there a way to transform the SCX file in DBF and, from this DBF, create a PRG file?
 
What's your motivation?

To turn every form into a PRG and replace any SCX and VCX from projects or to turn forms and classes into text files for source code version control?

For source code control there's SCCText, see there's also an improved version of that:
And then there are other alternatives, like TwoFox:
Chriss
 
FWIW, the PRG created by the Class Browser isn't (and isn't meant to be) runnable code.

Tamar
 
Tamar is right, and indeed the intention of ClassBrowserX is to create runnable PRGs.

[URL unfurl="true" said:
https://github.com/VFPX/ClassBrowserX[/URL]]ClassBrowserX makes a working PRG

So if that's the goal that's a solution. If you're after text for SCC (source code control) then AlternateSCCText and TwoFox handle some difficulties the original scctext has, but then also using the class browser to get a text version of the form is not at all the way to solve it, which also wouldn't make ClassBrowserX a solution, even though it produces runnable code. The intention of scctext differs, the major goal is of course also completeness, a missing DE would of course be bad for source versioning, but the other focus is on enabling merge of changes from two different branches of development.

Also the two scctext variants will be used in VFP options in the projects tab in the PRG you specify for "Text generation". And you couldn't specify an APP there, neither browser.app nor BrowserX.app.

That's why I ask, what's the motivation.

Chriss
 
Thx for all interactions...

The main problem still is that all DataEnvironment data is not being created.

datae_i9zkyj.png


dataee_vfo64p.png


I need that all this informations are contemplated when I create my PRG file...

I don't need an executable PRG....it is just to code source control on GitHub.
 
umnarcon said:
it is just to code source control on GitHub.

Well, besides the new recommendation by atlopes you were already pointed towards either scctext or better AlternateSCCText and TwoFox.

What have you tried? You show one unsuccessful result, but what did you use for that?

Chriss
 
Seems you find fx2bin.prg best to use.

I just tried alternateSCCText and on a solution form: datalook.scx and it includes the content of the Dataenvironment in the form of records:
Code:
[ RECORD]
[PLATFORM] WINDOWS 
[UNIQUEID] _R9G0NR4GU
[CLASS] cursor
[BASECLASS] cursor
[OBJNAME] Cursor1
[PARENT] Dataenvironment
[START PROPERTIES]
Alias = "orders"
CursorSource = "orders"
Database = ..\..\data\testdata.dbc
Height = 301
Left = 53
Name = "Cursor1"
Top = 141
Width = 99
[END PROPERTIES]

[ RECORD]
[PLATFORM] WINDOWS 
[UNIQUEID] _R9G0NR4H5
[CLASS] cursor
[BASECLASS] cursor
[OBJNAME] Cursor2
[PARENT] Dataenvironment
[START PROPERTIES]
Alias = "employee"
CursorSource = "employee"
Database = ..\..\data\testdata.dbc
Height = 90
Left = 150
Name = "Cursor2"
Top = 20
Width = 99
[END PROPERTIES]

Anyway, I see the prg as it is provided has this status about one-way vs two-way support:
Code:
* Text file support for each file type
*	0 indicates no text file support
*	1 indicates one-way support (to text)
*	2 indicates two-way support (for merging)
#DEFINE SCC_DBC_SUPPORT		0
#DEFINE SCC_DBF_SUPPORT		0
#DEFINE SCC_FORM_SUPPORT	1
#DEFINE SCC_LABEL_SUPPORT	1
#DEFINE SCC_MENU_SUPPORT	1
#DEFINE SCC_REPORT_SUPPORT	1
#DEFINE SCC_VCX_SUPPORT		1

Which indicates that alternatescctext can be used to have a text version of an SCX for source code control, but you need to check in the binary file, too, as you can't generate an SCX from the text file generated. There might be a better version of this available that does the two-way support.

Chriss
 
To not forget this: TwoFox does the two-way support, generating a text file 8with XML that can be checked in to Git or any SCC software and convert the text files back to binary format.

Chriss
 
Here is how to create a Dataenvironment in a PRG (Sorry for the French bits)


[pre]oForm = Createobject("form")
oForm.caption ="Un formulaire et son enviromement"
oForm.AddObject("oenv","de")
oForm.AddObject("command1","oButton")
oForm.command1.Visible = .T.
oForm.Show(1)
Define Class CUSTOMER As Cursor
Alias = "CUSTOMER"
CursorSource = "CUSTOMER"
Database = Home()+"SAMPLES\DATA\TESTDATA.DBC"
Enddefine

Define Class ORDERS As Cursor
Alias = "ORDERS"
CursorSource = "ORDERS"
Database = Home()+"SAMPLES\DATA\TESTDATA.DBC"
Enddefine

Define Class ORDITEMS As Cursor
Alias = "ORDITEMS"
CursorSource = "ORDITEMS"
Database = Home()+"SAMPLES\DATA\TESTDATA.DBC"
Enddefine

Define Class Cust_To_Orders As Relation
ChildAlias = "ORDERS"
ParentAlias = "CUSTOMER"
ChildOrder = "CUST_ID"
RelationalExpr = "CUST_ID"
Enddefine

Define Class Orders_To_OrdItems As Relation
ChildAlias = "ORDITEMS"
ParentAlias = "ORDERS"
ChildOrder = "ORDER_ID"
RelationalExpr = "ORDER_ID"
Enddefine

Define Class DE As DataEnvironment
Add Object oCUSTOMER As CUSTOMER
Add Object oORDERS As ORDERS
Add Object oORDITEMS As ORDITEMS
Add Object oCust_To_Orders As Cust_To_Orders
Add Object oOrders_To_OrdItems As Orders_To_OrdItems

Procedure Init
This.OpenTables()
Endproc

Enddefine
Define Class oButton As CommandButton
Caption ="Ouvrir la table customer"
height = 23
width = 150
top = 20
left = 20
Procedure Click
Select CUSTOMER
Browse
Endproc
Enddefine
[/pre]



If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike Gagnon,

thanks for that idea. It applies to the case where you want this prg to work, but for SCC all that matters is getting the information and being able to reproduce the binary scx form in the end.

So the DE data can also be stored in XML of records, as TwoFox handes this, or in a record format AlternateSCCText uses. What's not working with the AlternateSCCText version I got is the inverse step. And I think there should be a version that does that.

I havn't tried how foxbin2prg works, but it does seem to do the job, too.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top