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

Class Definition not found?

Status
Not open for further replies.

Loomis

Programmer
Jan 4, 2000
30
US
I am adding objects to a page in a pageframe by using the following code in the Activate Method of the Page:

This.AddObject('page2obj', 'page2obj')

I added the class "page2obj" to the project. The class was created by highlighting some controls and then choosing "save as class..." from the VFP8 file menu. When I run the form and activate the page, I get the following message: Class definition PAGE2OBJ is not found. Why can't PAGE2OBJ be found?

Loomis
 
Hi !
In addition my approach once you are having more classes.
I put this piece of code in my start.prg:

Code:
lcCurClassLib=SET("CLASSLIB")
IF ! "myClass1" $ lcCurClassLib
  set classlib to myClass1 additive
endif	

IF ! "myClass2" $ lcCurClassLib
  set classlib to myClass2 additive
ENDIF

a.s.o.

-Bart
 
Nifrabar

Beware of case sensitive functions! When you use set classlib to, the class reference becames ALL CAPS.

Code:
SET CLASSLIB TO c:\_movers.vcx addi
? SET("Classlib")  && result 'C:\_MOVERS.VCX'

I would suggest you change your function to
Code:
lcCurClassLib=SET("CLASSLIB")
IF ! [B]UPPPER[/B]("myClass1") $ lcCurClassLib
  set classlib to myClass1 additive
endif    

IF ! [B]UPPER[/B]("myClass2") $ lcCurClassLib
  set classlib to myClass2 additive
ENDIF



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,
You are right,
In the code I have in my app the classname is in CAPS all.
Just to make the code better to read I introduced the 'myClass' in my example and did not respect the CAPS.
Thanks for your correction on this issue.
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top