Board index » delphi » Property Editor for Stringlist not working?

Property Editor for Stringlist not working?

Last time I asked a question here, I got a huge response, all of which were
helpful,
so I thought I'd try my luck again.

I've made a new component based on a TGroupBox, and I want it to have a
TStringList property which the user can edit at design time.  You set up a
list of strings here, and those strings appear as TLabels inside the group
box.

I've done all the work to get the TLabels displayed if I programmatically
build
the TStringList, and when I install the component on my component palette,
and place it on a new form, the TStringList property appears in the Object
Inspector, with it's "..." icon at the end.  But when you click on the
Property
Editor icon ("..."), it complains that it
"Cannot assign a nil to a TRichEditStrings."

I've looked all over the place in the help files and the manuals, and I've
found
out all sorts of exciting things, including how to write my own Property
Editors,
but none of them tell me how to actually use the existing ones.  I thought
it
would be an automatic thing.  Any suggestions?
--
Grant Berridge
Analyst/Programmer
Symantics Software Ltd ( sy...@netlink.co.nz )

 

Re:Property Editor for Stringlist not working?


Quote
Grant Berridge wrote:
> Last time I asked a question here, I got a huge response, all of which
> were
> helpful,
> so I thought I'd try my luck again.

> I've made a new component based on a TGroupBox, and I want it to have
> a
> TStringList property which the user can edit at design time.  You set
> up a
> list of strings here, and those strings appear as TLabels inside the
> group
> box.

> I've done all the work to get the TLabels displayed if I
> programmatically
> build
> the TStringList, and when I install the component on my component
> palette,
> and place it on a new form, the TStringList property appears in the
> Object
> Inspector, with it's "..." icon at the end.  But when you click on the

> Property
> Editor icon ("..."), it complains that it
> "Cannot assign a nil to a TRichEditStrings."

> I've looked all over the place in the help files and the manuals, and
> I've
> found
> out all sorts of exciting things, including how to write my own
> Property
> Editors,
> but none of them tell me how to actually use the existing ones.  I
> thought
> it
> would be an automatic thing.  Any suggestions?

Normally it is an automatic thing.  How do you have your property
defined?

Mike

Re:Property Editor for Stringlist not working?


On 17 Aug 1997 23:55:30 GMT, "Grant Berridge" <sy...@netlink.co.nz>
wrote:

Quote
>Last time I asked a question here, I got a huge response, all of which were
>helpful,
>so I thought I'd try my luck again.

>I've made a new component based on a TGroupBox, and I want it to have a
>TStringList property which the user can edit at design time.  You set up a
>list of strings here, and those strings appear as TLabels inside the group
>box.

>I've done all the work to get the TLabels displayed if I programmatically
>build
>the TStringList, and when I install the component on my component palette,
>and place it on a new form, the TStringList property appears in the Object
>Inspector, with it's "..." icon at the end.  But when you click on the
>Property
>Editor icon ("..."), it complains that it
>"Cannot assign a nil to a TRichEditStrings."

This is the (somewhat misleading) error you get if you declare your
class property as TStringList instead of TStrings.  You should CREATE
a TStringList in the component code, but in order for the property
editor to work it wants a TStrings property.

Could that be the problem?

Regards,

Stephen Posey
slpo...@concentric.net

Re:Property Editor for Stringlist not working?


In article <01bcab69$55c01a20$b35c1bca@pat>
           sy...@netlink.co.nz "Grant Berridge" writes:

Try the following:
 Store the Property as TStrings.

 In your create proc, Assign it a newly created TStringList: e.g.:

 FStringProp := TStringList.Create;

 In your published section define the property as having a write METHOD!

 e.g.
 published
  property MyStrings : TStrings read FStringProp write SetStrings;

 then write into your protected / private / public section:
  Procedure SetStrings(Value : TStrings);

 then the Procedure needs to be:

 Procedure TMyDerivedComponent.SetStrings(Value : TStrings);
 begin
  FStringProp.Assign(Value);
 end;

 That should help.
 If you need, I can dig up some component source.
 If you have the VCL source, lookup components like TListBox or TMemo

Quote
> Last time I asked a question here, I got a huge response, all of which were
> helpful,
> so I thought I'd try my luck again.

> I've made a new component based on a TGroupBox, and I want it to have a
> TStringList property which the user can edit at design time.  You set up a
> list of strings here, and those strings appear as TLabels inside the group
> box.

> I've done all the work to get the TLabels displayed if I programmatically
> build
> the TStringList, and when I install the component on my component palette,
> and place it on a new form, the TStringList property appears in the Object
> Inspector, with it's "..." icon at the end.  But when you click on the
> Property
> Editor icon ("..."), it complains that it
> "Cannot assign a nil to a TRichEditStrings."

> I've looked all over the place in the help files and the manuals, and I've
> found
> out all sorts of exciting things, including how to write my own Property
> Editors,
> but none of them tell me how to actually use the existing ones.  I thought
> it
> would be an automatic thing.  Any suggestions?
> --
> Grant Berridge
> Analyst/Programmer
> Symantics Software Ltd ( sy...@netlink.co.nz )

--
Daniel Silverstone (Usually ;)

Look at the farstar Homepages on:
 http://www.farstar.demon.co.uk/

Try out Daniel's TPascal Page & Delphi 2.0 bits at
 http://www.farstar.demon.co.uk/Pascal/index.htm

Mail me & give comments (I know it's sparse ;)
 mailto:WebMas...@farstar.demon.co.uk

Other Threads