in Delphi 7 , when adding a propery to an object, how is it possible to see that property in the object inspector?
Make the property published
. For instance,
private
FMyProperty: integer;
published
property MyProperty: integer read FMyProperty write FMyProperty;
Often, you need to repaint the control (or do some other processing) when a property is changed. Then you can do
private
FMyProperty: integer;
procedure SetMyProperty(MyProperty: integer);
published
property MyProperty: integer read FMyProperty write SetMyProperty;
...
procedure TMyControl.SetMyProperty(MyProperty: integer);
begin
if FMyProperty <> MyProperty then
begin
FMyProperty := MyProperty;
Invalidate; // for example
end;
end;
Add that property to the published section, it will make it appear on the Object Inspector, like this:
TMyComponent = class(TComponent)
...
published
property MyProperty: string read FMyProperty write SetMyProperty;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With