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

Converting back a vcx from a vc2 a error is reported incorrect Class defined twice Error 1098. #77

Closed bjornhoeksel closed 2 years ago

bjornhoeksel commented 2 years ago

ℹ Computer information

📝 Provide detailed reproduction steps (if any)

Converting back a vcx from a vc2 a error is reported incorrect Class defined twice. This happens when name of control is same as name of control used on form

See sample attachment vc2 file if converted back to vcx problem is reported

Error 1098, Class defined twice.

problem is caused by the following code: SELECT TABLABIN LOCATE; FOR OBJNAME==loClase._ObjName IF FOUND() THEN SF 20211207 SET STEP ON Error loLang.C_ClassTwice_Header_LOC + ; loLang.C_ClassTwice_Lib_LOC + JUSTFNAME( DBF() ) + ; loLang.C_ClassTwice_Class_LOC + loClase._ObjName+0h0D0A ENDIF &&FOUND()

✔️ Expected result

No error

brl_obj.VC2.txt

lscheffler commented 2 years ago

Just to be clear:
So, you say the name of the control is the same name as the class of this very control.
In your example:
ADD OBJECT 'PGF_SETUP.Page1.cbo_brl_rule_type' AS cbo_brl_rule_type WITH ;

lscheffler commented 2 years ago

Inserting a class, the test just checks if the Objname field of the vcx to create holds a string twice without checking for empty Parent, so it finds objects named equal to a class.

Since creating a merge is a lengthy process, and I like to incorporate #78, replace in the code pointed out by you

LOCATE;
FOR OBJNAME==loClase._ObjName

with

LOCATE;
FOR OBJNAME==loClase._ObjName AND EMPTY(Parent)

and rebuild the exe

bjornhoeksel commented 2 years ago

Inserting a class, the test just checks if the Objname field of the vcx to create holds a string twice without checking for empty Parent, so it finds objects named equal to a class.

Since creating a merge is a lengthy process, and I like to incorporate #78, replace in the code pointed out by you

LOCATE;
FOR OBJNAME==loClase._ObjName

with

LOCATE;
FOR OBJNAME==loClase._ObjName AND EMPTY(Parent)

and rebuild the exe

Hi

I tested the suggested fix and it works ok