Thread View: comp.lang.pascal.delphi.components.writing
2 messages
2 total messages
Started by Marc Scheuner
Thu, 26 Feb 1998 00:00
Object type property
Author: Marc Scheuner
Date: Thu, 26 Feb 1998 00:00
Date: Thu, 26 Feb 1998 00:00
39 lines
2012 bytes
2012 bytes
Folks
I need to have a property in one of my components that will be visible
in the object inspector, and that works like the "Font" property in
that it will fold open and display a number of related properties.
What I'm trying to do is to bundle together a number of field names in
a table that I need to reference. I declared a type
TFieldNames = class (* MSE *)
Prop : String;
Form : String;
ValueD : String;
ValueF : String;
ValueI : String;
end;
and used it in my component as a property:
property FieldNames : TFieldNames read FFieldNames
write FFieldNames;
In the constructor of my component, I create the internal FFieldNames
variable. I see this property in the object inspector, but I can't get
it to fold open nicely, I always get nothing but a General Protection
Fault.
What am I missing? Do I need a property editor, just for a few
strings? Am I missing something else? Can someone provide a sample of
a component with such a property that's working properly??
Thanks in advance!
Marc
======================================================================
[ Marc Scheuner, marc.scheuner@berner.ch CH-3001 BERNE, Switzerland ]
======================================================================
Re: Object type property
Author: Robert Cerny
Date: Fri, 27 Feb 1998 00:00
Date: Fri, 27 Feb 1998 00:00
64 lines
2636 bytes
2636 bytes
Marc Scheuner <marc.scheuner@NO.SPAM.PLEASE.ch> wrote in article
<34f53726.9264792@news.bernoise.ch>...
> Folks
>
> I need to have a property in one of my components that will be visible
> in the object inspector, and that works like the "Font" property in
> that it will fold open and display a number of related properties.
>
> What I'm trying to do is to bundle together a number of field names in
> a table that I need to reference. I declared a type
>
> TFieldNames = class (* MSE *)
> Prop : String;
> Form : String;
> ValueD : String;
> ValueF : String;
> ValueI : String;
> end;
>
> and used it in my component as a property:
>
> property FieldNames : TFieldNames read FFieldNames
> write FFieldNames;
>
> In the constructor of my component, I create the internal FFieldNames
> variable. I see this property in the object inspector, but I can't get
> it to fold open nicely, I always get nothing but a General Protection
> Fault.
>
> What am I missing? Do I need a property editor, just for a few
> strings? Am I missing something else? Can someone provide a sample of
> a component with such a property that's working properly??
>
1. TFieldNames MUST descend from TPersistent and must implement Assign
method
2. Values to see in object inspector must be declared as published
properties.
3. The component that uses this object must have write access method
instead of field
TFieldNames = class (TPersistent) {1.}
fProp : String;
procedure Assign(Source:TPersistent); override; {1.}
published
property Prop:string read fProp write fProp; {!!!!2.}
....
property FieldNames : TFieldNames read FFieldNames write SetFieldNames;
{!!3.}
.....
procedure xx.SetFieldNames(AFieldNames : TFieldNames);
begin
FFieldNames.Assign(AFieldNames)
end;
--
-------------------------
Regards,
Robert
Remove leading aa when replying.
MailTo: aarobert.cerny@eunet.si
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads