RE: [DUG]: Property Editor for an object

2001-07-23 Thread Max Nilson

Edward Huang asked:

 In object inspector, we can expand properties like 'Font', 'Constraints'
 etc, and set property for these objects.

 How can I let Delphi to expand my own object property like them?
 At moment, a customised object property comes up a dropdown box
 with no options to select.

I am presuming Delphi 5+, because this stuff gets really complex in Delphi 4
due to an unfortunate limitation of the old property editor code.

In any case all that you need to do is register a property editor for the
class that has this sub component using the TClassProperty property editor
defined in DsgnIntf along the lines of the following code:

uses
  DsgnUIntf.

procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(TMySubClass), TMyMasterClass,
'MySubClassPropertyName', TClassProperty);
end;

If you use the subclass in more than one place, or for more than one
property you can twiddle the above parameters to be more generous in the
internal matching when Delphi is looking for a property editor.

By default Delphi provides you with the standard TComponentProperty property
editor, which assumes that you want to have a component refered to, rather
than a actual component instance exposed.

For more fun and excitement I recommend reading DsgnIntf closely, or at
least the header portion.

Cheers, Max.


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



RE: [DUG]: Property Editor for an object

2001-07-23 Thread Edward Huang

Thanks.  I'll have a play with it.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Max Nilson
Sent: Monday, 23 July 2001 6:50 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Property Editor for an object


Edward Huang asked:

 In object inspector, we can expand properties like 'Font', 'Constraints'
 etc, and set property for these objects.

 How can I let Delphi to expand my own object property like them?
 At moment, a customised object property comes up a dropdown box
 with no options to select.

I am presuming Delphi 5+, because this stuff gets really complex in Delphi 4
due to an unfortunate limitation of the old property editor code.

In any case all that you need to do is register a property editor for the
class that has this sub component using the TClassProperty property editor
defined in DsgnIntf along the lines of the following code:

uses
  DsgnUIntf.

procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(TMySubClass), TMyMasterClass,
'MySubClassPropertyName', TClassProperty);
end;

If you use the subclass in more than one place, or for more than one
property you can twiddle the above parameters to be more generous in the
internal matching when Delphi is looking for a property editor.

By default Delphi provides you with the standard TComponentProperty property
editor, which assumes that you want to have a component refered to, rather
than a actual component instance exposed.

For more fun and excitement I recommend reading DsgnIntf closely, or at
least the header portion.

Cheers, Max.


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/



[DUG]: Property Editor for an object

2001-07-22 Thread Edward Huang

Hi, All,

I think it's a easy question...

In object inspector, we can expand properties like 'Font', 'Constraints'
etc, and set property for these objects.

How can I let Delphi to expand my own object property like them?  At moment,
a customised object property comes up a dropdown box with no options to
select.

Thanks,

Edward

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of unsubscribe delphi
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/