I am sure I received a good answer to my previous question , because earlier I had a lot of help on other issues from the guys who posted there.
But I'm obviously doing something wrong, because when I copy the sample code that the object inspector for the MyProp property shows me, this is one text input field. I expected to see something similar to the Font property with Pitch, a font family, etc. I expect to see a tree structure, but I do not see the Color, Height, or Width properties of the MyProp property.
Any ideas? Again, I just copied this code.
Edit: I forgot to mention (in this question) that I am using a TMS pro script that allows users to create forms at runtime and provides their own object inspector, but this probably comes from Delphi standard material, I think.
Anyway, it seems I'm too dumb to code Delphi, since I just can't get it to work.
Edit: TMS assure me that if a class with โsub-propertiesโ comes from TPresistent, it will appear in the object inspector with sub-properties, just like Font, Anchors, etc.
When I use this code, the Warning property appears as a text field in the object inspector and has no sub-properties
unit IntegerEditBox; // An edit box which only accepts integer values and warns if the value is not in a certain range interface uses SysUtils, Classes, Controls, StdCtrls, EditBox_BaseClass; type TWarning = Class(TPersistent) private FWarningBelowValue : Integer; FWarningAboveValue : Integer; FWarningEmailTo : String; FWarningSmsTo : String; published property WarningBelowValue : Integer read FWarningBelowValue write FWarningBelowValue; property WarningAboveValue : Integer read FWarningAboveValue write FWarningAboveValue; property WarningEmailTo : String read FWarningEmailTo write FWarningEmailTo; property WarningSmsTo : string read FWarningSmsTo write FWarningSmsTo; end; TIntegerEditBox = class(TEditBox_BaseClass) private FWarning : TWarning; procedure WriteValue(const newValue : Integer); protected // The new property which w/e introduce in this class FValue : Integer; public { Public declarations } Constructor Create(AOwner: TComponent); override; // This constructor uses defaults property Text; published { Published declarations - available in the Object Inspector at design-time } property Hint; // Now our own properties, which we are adding in this class property Value : Integer read FValue write WriteValue; property Warning : TWarning read FWarning write FWarning ; end; // of class TIntegerEditBox() procedure Register; implementation uses Dialogs; procedure Register; begin RegisterComponents('Standard', [TIntegerEditBox]); end; Constructor TIntegerEditBox.Create(AOwner: TComponent); begin inherited; // Call the parent Create method Hint := 'Only accepts a number|Only accepts a number'; // Tooltip | status bar text Mandatory := True; Value := 0; Text := IntToStr(Value); end; procedure TIntegerEditBox.WriteValue(const newValue : Integer); begin Text := IntToStr(newValue); end; end.