![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Создаю свой компонент на основе TCombobox. Переопределил create и понял, что свойство name еще не определено и, соответственно, свойство text так же выставить не получается. А таких методов, как Show у него нет. Может кто подскажет, как быть?
|
|
#2
|
||||
|
||||
|
А вы конструктор родителя вызываете в своем конструкторе? Такую штуку как inherited используете?
|
|
#3
|
|||
|
|||
|
Код:
unit MemComboBox;
interface
uses
System.SysUtils, Vcl.Controls, Vcl.StdCtrls, inifiles, System.Classes, vcl.forms;
type
TMemComboBox = class(TComboBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMemComboBox]);
end;
{ TMemComboBox }
constructor TMemComboBox.Create(AOwner: TComponent);
var s: string;
begin
inherited Create(AOwner);
self.text:='example';
end;
destructor TMemComboBox.Destroy;
begin
inherited;
end;Все как по букварю ![]() Последний раз редактировалось smile.vadim, 25.09.2018 в 06:48. |