Board index » delphi » Class not found error

Class not found error

I want to create a component that has three radio buttons and a label
on a panel. The class is defined as follows:

type
  TTriplePanel = class(TPanel)
    L : TLabel;
    Y, N, NA : TRadioButton;
  public
    function GetBtnValue : string;
    procedure SetBtnValue(C : char);
    constructor Create(Owner : TComponent); override;
    destructor Destroy; override;
  end;

After dropping an instance on a form and running it, I get either a
TLabel or TRadioButton class not found error. This is undoubtedly
something very simply I've left out. I'd appreciate pointers on what
that might be.

Mark Shapiro
info...@swbell.net
.

 

Re:Class not found error


Mark,

Here's the first thing that pops into my mind and the most obivious. Do you
have the "stdctrls" unit included in your uses clause? Both classes are
defined in this unit.

R-

Quote
"Mark Shapiro" <info...@swbell.net> wrote in message

news:ndgc4u0v6bqfrqni57f4fnfpre67voqfpv@4ax.com...
Quote
> I want to create a component that has three radio buttons and a label
> on a panel. The class is defined as follows:

> type
>   TTriplePanel = class(TPanel)
>     L : TLabel;
>     Y, N, NA : TRadioButton;
>   public
>     function GetBtnValue : string;
>     procedure SetBtnValue(C : char);
>     constructor Create(Owner : TComponent); override;
>     destructor Destroy; override;
>   end;

> After dropping an instance on a form and running it, I get either a
> TLabel or TRadioButton class not found error. This is undoubtedly
> something very simply I've left out. I'd appreciate pointers on what
> that might be.

> Mark Shapiro
> info...@swbell.net
> .

Re:Class not found error


Yes, StdCtrls is in the Uses clause. Here's an excerpt from the
constructor since that's the only other place TLabel is mentioned:

constructor TTriplePanel.Create(Owner : TComponent);
begin
  inherited Create(Owner);
  L := TLabel.Create(Owner);
  Y := TRadioButton.Create(Owner);
  N := TRadioButton.Create(Owner);
  {set properties here}
end;

Mark Shapiro
info...@swbell.net
.

Re:Class not found error


Well, it was something totally simple. That error will occur if the
label or radiobutton components are not explicitly named when the form
is created.

Mark Shapiro
info...@swbell.net
.

Other Threads