Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Для новичков > Созданный компонент не отображается в палитре


Автор: lavrenty 12.10.2012, 23:18
Здравствуйте все! Пробую создать свой компонент в D2010. Ни разу раньше не делал, взял простой пример, всё вроде прошло, ошибок нет. Библиотеку bpl (с моим компонентом) через Component -> Install Packages подключил, но ни палитры, ни компонента не вижу. Что не так делаю?

Автор: northener 13.10.2012, 00:16
Цитата(lavrenty @  12.10.2012,  23:18 Найти цитируемый пост)
Ни разу раньше не делал, взял простой пример, всё вроде прошло, ошибок нет. 

Код в студию!

Автор: lavrenty 13.10.2012, 09:33
Код

unit CountBtn;

interface

uses
  System.SysUtils, System.Classes, Vcl.Controls, Vcl.StdCtrls, Vcl.Dialogs;

type
  TCountBtn = class(TButton)
  private
    { Private declarations }
    FCount  : integer;

  protected
    { Protected declarations }

  public
    { Public declarations }
    procedure ShowCount;
    procedure Click ; override;
  published
    { Published declarations }
    property Count  : integer read FCount write FCount;
    constructor Create(Aowner : TComponent); override;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('MyComponents', [TCountBtn]);
end;

constructor TCountBtn.Create(Aowner : TComponent);
begin
  inherited Create(Aowner);
end;

procedure TCountBtn.ShowCount;
begin
 Showmessage('По кнопке '+ caption+' вы сделали: '+inttostr(FCount)+' клик(а/ов)');
end;


end.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)