Recent

Author Topic: Class not found  (Read 7360 times)

iru

  • Sr. Member
  • ****
  • Posts: 321
Class not found
« on: January 07, 2011, 07:10:18 am »
gentlefolk,

Laz 0.9.29, build 28602, Win XP SP3.

I have a form which from other similar experience seems to be corrupted in some way.

The program compiles OK but when attempting to execute takes and exception complaining about 'no resources' for the event 'FormShow'. Remove all references/ events/etc to formShow and then I crash with another exception with the message 'class TDBnavigator not found'.

I have other similar experiences with the relationship between the .lrm file and the .pas file getting out of sync.

So from this experience I have:
  deleted the <form>.lrm file - problem still exists.
  commented out all references to the the navigator objects in the .pas file - problem still exists.

The lazarus ide is bog standard default install, tried the 'environment.rescan fpc source directory' trick, restarted laz and windows XP. Still got the problem

I could delete the form and rebuild it but it is fairly complex and would take some time.

Can anyone shed any light on this, point me in the correct direction to resolve the issue?

Thanks, Ian
 

iru

  • Sr. Member
  • ****
  • Posts: 321
Re: Class not found
« Reply #1 on: January 07, 2011, 11:02:44 am »
Gentlefolk,

A little more.

I removed the offending .pas and .lfm files.

Copied the two original files (from a previous project).

Compiled and corrected some minor issuess with undefined constants, 'uses' files, added a method.

Compiles clean.

On execution throws an exception 'EReadError', message 'error reading FR.OnShow Invalid value for property' which is the same error which initially occured in the previous version of the file.

Still stuck on this one, help!!!!

Ian




Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Class not found
« Reply #2 on: January 07, 2011, 11:36:00 am »
Quote
On execution throws an exception 'EReadError', message 'error reading FR.OnShow Invalid value for property' which is the same error which initially occured in the previous version of the file.
Broken lfm. Open it and see where OnShow points to, ensure it points to an existing method and its signature matches.

iru

  • Sr. Member
  • ****
  • Posts: 321
Re: Class not found
« Reply #3 on: January 07, 2011, 11:56:13 am »
Gentlefolk,

Problem solved, the problem is me!

The project is a mixture of new modules and modules from a similar older project.

The problem was that in an old module and a new module I had an object/class with the same name.

For example:
 
type
  TFR = class(TForm)
    ..
    ..
  end;

var
  FR : TFR;

Where FR was defined in two modules.

The exception error message left something to be desired but if you sit and look at something long enough and assume nothing and do not trust anybody (including yourself) sometimes things get worked out....

Ian
 

iru

  • Sr. Member
  • ****
  • Posts: 321
Re: Class not found
« Reply #4 on: January 07, 2011, 12:17:38 pm »
Gentlefolk,

Thanks for the suggestion on a corrupt/brokrn .lfm.

Should not the compiler picked multiple 'FR' objects? I simply changed one to 'FR' to 'FRE' in one case. The class types (TFR and TFRE) were different. 

Ian

 

TinyPortal © 2005-2018