Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-03

Unable to find the unit if the component class "TNoBackPage"

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello lazarus project!

I have my own component, which successfully installed into Lazarus. When I use this component on any form after reopening/reloading form it reports an error. That is a simple notebook implementation with no background to get pages transparent.

That component's unit contains:

unit NoBackNotebook;
INTERFACE
USES  LMessages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls, LCLType;
TYPE
  TNoBackPage = class(TCustomControl)
  private
  ...
  TNoBackNotebook = class(TCustomControl)
  private
    FPageList: TList;
    FAccess: TStrings;
    FPageIndex: Integer;
  ...
IMPLEMENTATION
type
  TNoBackPageAccess = class(TStrings)
  private
    PageList: TList;
    Notebook: TNoBackNotebook;
constructor TNoBackNotebook.Create(AOwner: TComponent);
const SDefault = 'Default';
begin
  inherited Create(AOwner);
  Width := 150;
  Height := 150;
  FPageList := TList.Create;
  FAccess := TNoBackPageAccess.Create(FPageList, Self);
  FPageIndex := -1;
  FAccess.Add(SDefault);
  PageIndex := 0;
  Exclude(FComponentStyle, csInheritable);
  if not Registered then
  begin
    Classes.RegisterClasses([TNoBackPage]);
    Registered := True;
  end;
end;

--------------------------

LFM file contains of form contains:

...
object NoBackNotebook1: TNoBackNotebook
Left = 184
Height = 150
Top = 104
Width = 150
TabOrder = 1
object TNoBackPage
Left = 0
Top = 0
Caption = 'Default'

    end
  end

...

---------------------------

When Lazarus starts this is reported:

TMainIDE.ParseCmdLineOptions:
PrimaryConfigPath="/Users/test/.lazarus"
SecondaryConfigPath="/etc/lazarus"
NOTE: help options config file not found - using defaults TMainIDE.DoLoadLFM A /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas IsPartOfProject=True QuickCheckLFMBuffer LFMBuffer=/usr/local/share/lazarus/rotursoft/tests/components/unit1.lfm FindMissingClass :TNoBackPage IsInherited=False
TMainIDE.DoLoadLFM loading nested class TNoBackPage needed by /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas TMainIDE.DoLoadComponentDependencyHidden
/usr/local/share/lazarus/rotursoft/tests/components/unit1.pas AComponentClassName=TNoBackPage AComponentClass=nil TCarbonBitBtn.SetFocus Error: SetKeyboardFocus failed with result -30585 TCarbonBit

-------

The fact is, that this component was working in October 2008 when I used my project, but latest build I am using not.

Thanks for all ideas what I can change.

Reply by email

Mattias Gaertner
to Roland Turcan
Show quoted text 101 lines
Hello lazarus project! I have my own component, which successfully installed into Lazarus. When I use this component on any form after reopening/reloading form it reports an error. That is a simple notebook implementation with no background to get pages transparent. That component's unit contains: unit NoBackNotebook; INTERFACE USES LMessages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, LCLType; TYPE TNoBackPage = class(TCustomControl) private ... TNoBackNotebook = class(TCustomControl) private FPageList: TList; FAccess: TStrings; FPageIndex: Integer; ... IMPLEMENTATION type TNoBackPageAccess = class(TStrings) private PageList: TList; Notebook: TNoBackNotebook; constructor TNoBackNotebook.Create(AOwner: TComponent); const SDefault = 'Default'; begin inherited Create(AOwner); Width := 150; Height := 150; FPageList := TList.Create; FAccess := TNoBackPageAccess.Create(FPageList, Self); FPageIndex := -1; FAccess.Add(SDefault); PageIndex := 0; Exclude(FComponentStyle, csInheritable); if not Registered then begin Classes.RegisterClasses([TNoBackPage]); Registered := True; end; end; -------------------------- LFM file contains of form contains: ... object NoBackNotebook1: TNoBackNotebook Left = 184 Height = 150 Top = 104 Width = 150 TabOrder = 1 object TNoBackPage Left = 0 Top = 0 Caption = 'Default' end end ... --------------------------- When Lazarus starts this is reported: TMainIDE.ParseCmdLineOptions: PrimaryConfigPath="/Users/test/.lazarus" SecondaryConfigPath="/etc/lazarus" NOTE: help options config file not found - using defaults TMainIDE.DoLoadLFM A /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas IsPartOfProject=True QuickCheckLFMBuffer LFMBuffer=/usr/local/share/lazarus/rotursoft/tests/components/unit1.lfm FindMissingClass :TNoBackPage IsInherited=False TMainIDE.DoLoadLFM loading nested class TNoBackPage needed by /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas TMainIDE.DoLoadComponentDependencyHidden /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas AComponentClassName=TNoBackPage AComponentClass=nil TCarbonBitBtn.SetFocus Error: SetKeyboardFocus failed with result -30585 TCarbonBit ------- The fact is, that this component was working in October 2008 when I used my project, but latest build I am using not. Thanks for all ideas what I can change.

Have you tried to register the class TNoBackPage earlier, for example in a Register procedure?

Mattias

Reply by email

Roland Turcan
to Mattias Gaertner

Hello Mattias,

MG> Have you tried to register the class TNoBackPage earlier, for example MG> in a Register procedure?

I have ported this code from Delphi 7, where the register procedure contains:

PROCEDURE Register;
BEGIN
  RegisterComponents ('rotursoft', [TNoBackNotebook]);
END;

Shall I add registration of TNoBackPage too?

Thanks.

TRoland;

<<< 11.3.2009 12:27 - Mattias Gaertner "" >>>
MG> On Wed, 11 Mar 2009 11:30:52 +0100

MG> Roland Turcan wrote 101 lines
> Hello lazarus project! > > I have my own component, which successfully installed into Lazarus. > When I use this component on any form after reopening/reloading form > it reports an error. That is a simple notebook implementation with no > background to get pages transparent. > > That component's unit contains: > > unit NoBackNotebook; > > INTERFACE > > USES LMessages, SysUtils, Classes, Graphics, Controls, Forms, > Dialogs, ExtCtrls, LCLType; > > TYPE > TNoBackPage = class(TCustomControl) > private > ... > > TNoBackNotebook = class(TCustomControl) > private > FPageList: TList; > FAccess: TStrings; > FPageIndex: Integer; > ... > > IMPLEMENTATION > > type > TNoBackPageAccess = class(TStrings) > private > PageList: TList; > Notebook: TNoBackNotebook; > > constructor TNoBackNotebook.Create(AOwner: TComponent); > const SDefault = 'Default'; > begin > inherited Create(AOwner); > Width := 150; > Height := 150; > FPageList := TList.Create; > FAccess := TNoBackPageAccess.Create(FPageList, Self); > FPageIndex := -1; > FAccess.Add(SDefault); > PageIndex := 0; > Exclude(FComponentStyle, csInheritable); > if not Registered then > begin > Classes.RegisterClasses([TNoBackPage]); > Registered := True; > end; > end; > > -------------------------- > > LFM file contains of form contains: > > ... > object NoBackNotebook1: TNoBackNotebook > Left = 184 > Height = 150 > Top = 104 > Width = 150 > TabOrder = 1 > object TNoBackPage > Left = 0 > Top = 0 > Caption = 'Default' > end > end > ... > > --------------------------- > > When Lazarus starts this is reported: > > TMainIDE.ParseCmdLineOptions: > PrimaryConfigPath="/Users/test/.lazarus" > SecondaryConfigPath="/etc/lazarus" > NOTE: help options config file not found - using defaults > TMainIDE.DoLoadLFM > A /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas > IsPartOfProject=True QuickCheckLFMBuffer > LFMBuffer=/usr/local/share/lazarus/rotursoft/tests/components/unit1.lfm > FindMissingClass :TNoBackPage IsInherited=False TMainIDE.DoLoadLFM > loading nested class TNoBackPage needed > by /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas > TMainIDE.DoLoadComponentDependencyHidden /usr/local/share/lazarus/rotursoft/tests/components/unit1.pas > AComponentClassName=TNoBackPage AComponentClass=nil > TCarbonBitBtn.SetFocus Error: SetKeyboardFocus failed with result > -30585 TCarbonBit > > > ------- > > The fact is, that this component was working in October 2008 when I > used my project, but latest build I am using not. > > Thanks for all ideas what I can change.

MG> Have you tried to register the class TNoBackPage earlier, for example MG> in a Register procedure?

MG> Mattias

MG> _______________________________________________ MG> Lazarus mailing list
MG>
MG> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Hans-Peter Diettrich
to Roland Turcan: Hello lazarus project! I have my own component, which successfully installed into Lazarus.
I have my own component, which successfully installed into Lazarus. When I use this component on any form after reopening/reloading form it reports an error. That is a simple notebook implementation with no background to get pages transparent.

What's this?

constructor TNoBackNotebook.Create(AOwner: TComponent);

[...]

Show quoted text 6 lines
if not Registered then begin Classes.RegisterClasses([TNoBackPage]); Registered := True; end; end;

IMO the registration should occur in a Register procedure in the unit, at least *before* any instance is created.

DoDi

Reply by email

Roland Turcan
to Hans-Peter Diettrich

Hello Hans,

Thanks for your showing to the right direction.

You were right, that I had to move explicit registration of TNoBackPage to Register procedure as the main component has its own one. Afterwards I didn't get any more any exception from IDE.

Thanks again.

TRoland;

<<< 11.3.2009 14:11 - Hans-Peter Diettrich "" >>>

> I have my own component, which successfully installed into Lazarus. > When I use this component on any form after reopening/reloading form > it reports an error. That is a simple notebook implementation with no > background to get pages transparent.

HPD> What's this?

> constructor TNoBackNotebook.Create(AOwner: TComponent);

HPD> [...]

Show quoted text 6 lines
> if not Registered then > begin > Classes.RegisterClasses([TNoBackPage]); > Registered := True; > end; > end;

HPD> IMO the registration should occur in a Register procedure in the unit, HPD> at least *before* any instance is created.

HPD> DoDi

Reply by email