🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.components.writing
Article #40

Re: Object type property

#40
From: Robert Cerny
Date: Fri, 27 Feb 1998 00:00
64 lines
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
Technical Details
Message-ID: <01bd43cd$4e445660$2531a8c0@robertc_pc.internal.xrs.si>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34f53726.9264792@news.bernoise.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 112b07,e1bc3f3c82781c2c
X-Google-Attributes: gid112b07,public
X-Google-Thread: fe2ce,e1bc3f3c82781c2c
X-Google-Attributes: gidfe2ce,public
From: "Robert Cerny" <johnsmith@microsoft.com>
Subject: Re: Object type property
Date: 1998/02/27
Message-ID: <01bd43cd$4e445660$2531a8c0@robertc_pc.internal.xrs.si>
X-Deja-AN: 329142628
References: <34f53726.9264792@news.bernoise.ch>
Organization: Telekom Slovenije - SiOL - http://www.siol.net/
Newsgroups: comp.lang.pascal.delphi.components.writing,borland.public.delphi.vcl.components.writing