On 5 Jun 1997 07:49:24 GMT, "Sanne Hoekstra"
Quote
<NO_MORE_SPAM_Sant...@dds.dds.nl> wrote:
>Hi Stephen,
>See comment below.
[deletia]
Sorry about the errors in MY code, that'll teach me to compile it
myself before posting it; the following works fine on my system in D1
and D2. At design time, in the object inspector when I click on the
MyStringList property of the control I get the default string list
editor.
------------------------>8 cut here 8<--------------------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;
type
TMyComponent = class(TComponent)
private
fMyStringList: TStrings;
protected
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
public
published
property MyStringList: TStrings
read fMyStringList
write fMyStringList;
end ;
procedure Register;
implementation
constructor TMyComponent.Create(AOwner: TComponent);
begin
inherited Create( AOwner ) ;
fMyStringList := TStringList.Create;
end;
destructor TMyComponent.Destroy;
begin
fMyStringList.Free;
inherited Destroy ;
end;
procedure Register;
begin
RegisterComponents('Custom', [TMyComponent]);
end;
end.
------------------------>8 cut here 8<--------------------------------
Quote
>I changed it to your recommendations, everything works fine,
>until I click on the MyStringList property in the code inspector.
>Then I get an acess violation in VCL30.DPL.
I don't have D3 yet, but, unless they've significantly changed the
TString/TStringList behavior the above ought to work as well, let me
know if that's NOT the case and I'll investigate further.
Quote
>> constructor TMyComponent.Create(AOwner: TComponent);
>> begin
>> inherited Create(AOwner: TComponent) ;
>This gives an error on the TComponent. It expects an ")" instead of
>TComponent.
Silly error on my part, obviously you don't include the type like that
in the method CALL.
Quote
>> fMyStringList := TStringList.Create;
>Do you really mean TStringList.Create, and not TStrings.Create?
>I used TStringList.Create, but I still get an error when I change anything
>in this property in the object inspector.
This is what's puzzling me, you really WANT a StringList if you aren't
going to handle the storage and internal manipulation of the strings
yourself or they aren't being handled internally by some other control
(a la Windows' Edit or Listbox controls).
Quote
>Thank you for your help.
>--
>+++
>Use this address to Mail, no Spam_Mail.
>Sanne Hoekstra
>Sant...@dds.dds.nl
HTH
Stephen Posey
slpo...@concentric.net