rene100
asked on
New Component
Hi all
i've a problem with creating a new component:
I want to write a ComboBox that filles in all avaible
fonts automatical. her's what I done:
unit FontComboBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFontComboBox = class(TComboBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent);override;
{ Public declarations }
published
procedure UpdateFonts;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Eigene ', [TFontComboBox]);
end;
constructor TFontComboBox.Create(AOwne r: TComponent);
begin
Inherited Create(AOwner);
UpdateFonts;
end;
procedure TFontComboBox.UpdateFonts;
var
Index: integer;
begin
Clear; <-- Error here
For Index:=0 to Screen.Fonts.Count-1 do
Items.Add(Screen.Fonts[Ind ex]);
end;
end.
But everytime I create my new component in desgin-time
(I mean by dragging it on a form) or manipulating the items-property at runtime, I get the error-mesage:" Control '' has no parent window"
What's wrong?
regards
rene
i've a problem with creating a new component:
I want to write a ComboBox that filles in all avaible
fonts automatical. her's what I done:
unit FontComboBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFontComboBox = class(TComboBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent);override;
{ Public declarations }
published
procedure UpdateFonts;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Eigene
end;
constructor TFontComboBox.Create(AOwne
begin
Inherited Create(AOwner);
UpdateFonts;
end;
procedure TFontComboBox.UpdateFonts;
var
Index: integer;
begin
Clear; <-- Error here
For Index:=0 to Screen.Fonts.Count-1 do
Items.Add(Screen.Fonts[Ind
end;
end.
But everytime I create my new component in desgin-time
(I mean by dragging it on a form) or manipulating the items-property at runtime, I get the error-mesage:" Control '' has no parent window"
What's wrong?
regards
rene
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot!
regards
rene