fdbozzo / foxbin2prg

Visual FoxPro 9 Binary to Text and Text to Binary converter. Replacement for SCCText(X) and TwoFox that is bi-directional (Text is editable)
https://vfpx.codeplex.com/wikipage?title=FoxBin2Prg
MIT License
59 stars 35 forks source link

Bin2Text: Forms with ole controls conversion error #95

Closed KestasL closed 1 year ago

KestasL commented 1 year ago

ℹ Computer information

Convert form to sc2 has bug. If file collation different then 1252 ( in main case 1257) the ole value data is converted with errors and we can't convert back to scx, sct format. I solve the issue with modification to ole fields in data tables does not converted:

`

LINE 17365 With This As c_conversor_scx_a_prg Of 'FOXBIN2PRG.PRG' Use (.c_InputFile) Shared Again Noupdate Alias _TABLAORIG

`

LINE 17477 Scan Rest While Upper( TABLABIN.PLATFORM ) = "WINDOWS" And Lower( Alltrim( Getwordnum( TABLABIN.Parent, 1, '.' ) ) ) == Lower(lcObjName) lnObjCount = lnObjCount + 1 loRegObj = Null SET NOCPTRANS TO ole Scatter Memo Name loRegObj `

I'm not Visual FoxPro expert, so you can come up with more elegant solution.

lscheffler commented 1 year ago

@KestasL Hi, thanks for pointing this out. I will have to look into this - I never used something else then 1252, so all the code page commands are a odd to me.

lscheffler commented 1 year ago

@KestasL Some questions

please check foxbin2prg, line 1 and 2:

#DEFINE DN_FB2PRG_VERSION       1.19
#DEFINE DC_FB2PRG_VERSION_REAL  '1.19.78'

, the file should have a total of 33386 lines

LINE 17365

Is this a typo? My guess is you mean 17356.

LINE 17477

I see the SCAN .. at line 17459

See https://github.com/fdbozzo/foxbin2prg/blob/master/foxbin2prg.prg

But this just a version problem, the issue will be the same.


I guess the problem will raise for a vcx as well. I need you testing the problem. I have problems doing this, since it is bound to some ActiveX - and to your codepage. Please create a vcx like your scx and check if you can create the error. A simple container with your AcitveX and the properties of the ActiveX set like the scx will do. Run FoxBin2Prg against the VCX.

Please report if the problem exists in the vc2 file.

KestasL commented 1 year ago

Hello,

same problem with vcx files too. I made the OLE field to be in binary format, and now on mine system everything fine. P.S. don't pay attention to the line numbers (exact ones), I just wrote where you should look. And the lines may be shifted, as I made changes (the line number are with inserted code). In the code you should find where I put the command (by near code pattern) "SET NOCPTRANS TO ole". To ole data field be stored in binary format. I think this helps you :). Thanks for project.

lscheffler commented 1 year ago

@KestasL Ah, ok for the line numbers and the VCX's.

The solution is as you wrote, I just need to learn something about NOCPTRANS to place it optimal. (This is, I have no idea if it must be like

Use (.c_InputFile) Shared Again Noupdate Alias _TABLAORIG
*SF 20230804
*issue #95, set NOCPTRANS for the cursor
SET NOCPTRANS TO ole
Select _TABLAORIG.*,Recno() regnum From _TABLAORIG Into Cursor TABLABIN Readwrite
SET NOCPTRANS TO ole
Use In (Select("_TABLAORIG"))

, or if

Use (.c_InputFile) Shared Again Noupdate Alias _TABLAORIG
Select _TABLAORIG.*,Recno() regnum From _TABLAORIG Into Cursor TABLABIN Readwrite
*SF 20230804
*issue #95, set NOCPTRANS for the cursor
SET NOCPTRANS TO ole
Use In (Select("_TABLAORIG"))

will be enough (without the code near LINE 17477, because it is just calling it over and over for the same field))

So, would you mind to try it like the code in the second snippet, and without the other NOCPTRANS? Only SCX.

lscheffler commented 1 year ago

@KestasL could you please test the foxbin2prg.prg from https://github.com/lscheffler/foxbin2prg ?

It should run with vcx and scx. The file is version '1.19.79' on top.

Thank you.

Update: Or the exe from the same location

KestasL commented 1 year ago

I checked, yes, everything seems to be fine now. Thank you.

lscheffler commented 1 year ago

Fine!
I need some time to put out the release - I'm changing the way to release and it needs some testing. Until that, you can use the code from the fork. If you use FoxBin2Prg via Thor, I can tell you where to copy the file to. Just let me know.

KestasL commented 1 year ago

Hello, I have a working version (which I fixed myself earlier) and it's good enough for me (for my purposes). I will post a note on the GitHub page for your attention and fix the project so everyone can use the fixed version. So thanks, you can update whenever it's convenient for you and don't worry about me personally :)

lscheffler commented 1 year ago

Thank you!

lscheffler commented 1 year ago

Fixed version is available at https://github.com/lscheffler/foxbin2prg, no Thor update provided.

Jeff9000 commented 1 year ago

Lutz, thank you so much for keeping this fixed and up to date. We use it every day to update our code in BitBucket and our whole CI system. It's so amazing that we can use this tool to keep our efforts in FoxPro alive.