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

Broken Form in Visual FoxPro Editor 2

Status
Not open for further replies.

AnotherNovice1

Systems Engineer
Feb 9, 2021
17
0
0
DE
Hello everyone,

I have another (maybe dumb) question for you...
I have a project where I can open every *.SCX / *.SCT file and edit the forms...
Except for one.
There it throws an error:
"Error loading file - record number 18. _header1 <or one of its members >. Parent: Class definition _HEADER is not found."

The strangest part of it:
I can't access the file in Visual FoxPro, but when I build the application I can use that form without any problem.

What I tried so far:
Googling, googling, googling.
I did use the command USE <path to form>, then BROWSE LAST NOCAPTION and GO 18, to get to the entry.
I used the _HEADER definition on any other form without a problem.
Has anyone encountered a similar problem?
My problem with rebuilding that form is, that no team member from that time and age is no longer available (no one even knows where they live nowadays)...
I don't know if it helps to upload the form files...
Any helpful advice would be appreciated :)
 
I guess the header is part of a grid column and such member classes are often defined in PRGs. This record (or another) shoud have an entry for memberclass and memberclasslibrary, pointing out where to find it.

That you have other forms with a _header is likely what helps this formm to work, becasue at runtime VFP is not strict about the inheritence origin, if any class _header exists it can be used. Same also goes for the form or class designer. Usually in case a framework has such classes you initialize it by doing some PRG or creating some class instance that loads such generally necessary classes into memory by issuing a series of SET CLASSLIB TO... and SET PROCEDURE TO... in ADDITIVE modeReason is the priority with which VFP searches things in memory or on disc.

Chriss
 
Look in the Class and ClassLoc columns of row 18 to see where it's expecting to find the class. That might guide you.

Tamar
 
Hi everyone,
thanks for your tips.
I was unexpectedly away from work, due to health reasons,
I'm sorry for not looking into the forum :(

I will look into it and update this reply with the findings.

UPDATE:
Looked into the file,
the fields are containing the following:
class is "_header"
classloc is empty
baseclass is "header"
objname is "_header1"
parent is "frmHallenplan.grdHPlan._Column1"
properties is
FontSize = 8
Alignment = 2
Caption = "Linie"
Name = "_header1"​
Everything else is empty.
Rebuilding that form would be quite tough / next to impossbile due to vast amounts of logic in it.
Somehow even old records are broken and I can't access a working form.

UPDATE 2:
In the baseclass.prg I have:
DEFINE CLASS _header AS header
FontName="Arial"
FontSize=8
Alignment = 2
Caption = "Header1"
ENDDEFINE​
 
Code:
SET PROCEDURE TO C:\full\path\to\baseclass.prg

Do this before editing the form might help.

Or mend classloc, this should point to the prg, not be empty. And then it'll also work, when not setting the PROCEDURE to the prg.


Chriss
 
Thanks for the fast reply Chris!

Well I edited it for the correct path,
but sadly it doesn't do the job.
BUT:
I found a backup of that form and can open it.
But here comes the 'fun' part.
I can open it normally in that folder.
But not in the project if I add it to the project.
I replaced the baseclass.FXP and baseclass.prg file, too.

My Visual FoxPro Environment works apart from that normally and I can do minor changes on other forms without a problem...
EDIT:
I also edited the baseclass field and tried to set my environment to the path,
but still the same error.

EDIT 2:
After a miracle([ponder]) it tells my that my baseclass.vcx is missing the _header part...
Now it's getting interesting.
How on earth does one insert a new class in there?

EDIT 3:
If I have in my baseclass.PRG the following:

DEFINE CLASS _header AS header
FontName="Arial"
FontSize=8
Alignment = 2
Caption = "Header1"
ENDDEFINE

How do I get it into my VCX file?

In the dropdown there is no header available to choose from.
 
What did you enter into classloc?

It needs to be path + the prg file, with PRG file extension, otherwise VFP searches for a VCX.
The _header class is part of a PRG, not a VCX. And you can't have header member classes in a VCX. You donÄ'T need and you canÄt add a PRG class to a VCX, it#s used as memberclass.
Be sure you leave the info for the column of which this header is a member class as is or this kind of hacking the VCX data causes even more trouble, you only should point the memberclass to the PRG

Chriss
 
Yes Chris,

Edit:
What did you enter into classloc?

I inserted the path+file+file extension into it.
But it says it's not a table.


It needs to be path + the prg file, with PRG file extension, otherwise VFP searches for a VCX.
The _header class is part of a PRG, not a VCX. And you can't have header member classes in a VCX. You donÄ'T need and you can't add a PRG class to a VCX, it's used as memberclass.
Be sure you leave the info for the column of which this header is a member class as is or this kind of hacking the VCX data causes even more trouble, you only should point the memberclass to the PRG

What do you mean with that?
Which column is that?
Should I insert the path + class somewhere else?
 
Back to base zero

What do you actually edit, the SCX or the VCX with a grid class or column class?
It's all very sensitive to what you actually edit.

Maybe you don't even need to mend the SCX, just the definition of the grid or column class. We know what's missing is a good reference to the _header and you know it's defined in baseclass.prg.
Within the visual IDE the terms for class, parentclass, classloc and memberclass, memberclassloc don't map 1:1 to the field names of an SCX or VCX, so you need to know a bit and I may have pointed into the wrong direction, it's been a while since I hacked VFP files.

Anyway, I think what you actually need to fix is the grid or column class that is used in the form, not the form itself. But it could also be the header member class was only added on the form level. Questions over questions...

What happens when you leave the classloc empty (which lets VFP look into the same cliss library) and just SET PROCEDURE TO the baseclass.prg?

Then what's actually in the form? The root record has to be about a grid, that could be native or a grid class in some VCX library or in a PRG. Then this can have a standard grid column or a memberclass, then that can have a header member class, you likely will need to add some grandchild record not the level you edited for now. I'll have to see how things actually work in a healthy situation.

For now just tell us about a record you find in the SCX for the grid. If it's a grid class then you should continue within the grid class in the VCX or PRG.

Chriss
 
Hi Chris,

I only edit the SCX file.
It's acting pretty weird now...
I have a folder structure like this:
..\<project>\Maske\form.scx
If I copy my baseclass files into the folder "Maske", I can open that form now.
But I cannot open that form when I add it to my project.
Maybe the _header class must be defined in the grid as a memberclass? (properties column)


What happens when you leave the classloc empty (which lets VFP look into the same cliss library) and just SET PROCEDURE TO the baseclass.prg?
It says that "<path>\baseclass.prg is not a table".
error_t4kxta.png


Then what's actually in the form?
form_pc91o5.png

hallenplan1_tpq9nt.png

That's how the form looks. It lists basically a list of machines and adds many fields next to it with containers for work.
From my point of view it is a standard defined grid.

For now just tell us about a record you find in the SCX for the grid.
If it's a grid class then you should continue within the grid class in the VCX or PRG.

I can also add the needed files as a zip / 7zip file if you want.
 
Did you rearrange files? VFP works a lot with relative paths and so it doesn't like when dependent files (for parent classes or member classes) are not staying where they were. Many therefore put everything into one Folder, the project manager sorts the different types.

Chriss
 
Hi Chris,

sadly, no, I don't move files around there.
I only fix minor bugs in that project and don't create any new forms or objects in it.
I looked into the various properties and the baseclass.prg path is correct.
I can open that form individually, but not inside the project itself.
But I can open any other form in that project without any issue...
 
Hi Chris and any future reader!

I solved it.
I opened the form individually and resetted the associated header to each column.
Then I saved that form and opened it in my project.
The paths were correctly set, but (to me unknown reasons) it seemed to overwrite the correctly displayed path with the new (same) path.
And it worked.

Thanks Chris for the time you've taken with me and all the patience [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top