TTMSFNCObjectInspector.OnReadProperty Event
Occurs before an object property is read into the inspector.
API unit family: TMSFNCObjectInspector
Declaring type: TTMSFNCObjectInspector
Syntax
OnReadProperty: TTMSFNCObjectInspectorReadProperty;
__property TTMSFNCObjectInspectorReadProperty OnReadProperty = {read=FOnReadProperty, write=FOnReadProperty};
Parameters
| Name | Description |
|---|---|
Sender |
Inspector that is reading the property. |
AObject |
Object that owns the property. |
APropertyInfo |
Runtime property information. |
APropertyName |
Name of the property. |
APropertyType |
Type kind of the property. |
ACanRead |
Set to True to read the property; set to False to hide it. |
Usage examples
Hide and rewrite object property values
Uses read and write events to hide one property and normalize another value before it is written.
procedure TForm1.TMSFNCObjectInspector1ReadProperty(Sender: TObject;
AObject: TObject; APropertyInfo: TTMSFNCPropertyInfo; APropertyName: string;
APropertyType: TTypeKind; var ACanRead: Boolean);
begin
ACanRead := APropertyName <> 'InternalToken';
end;
procedure TForm1.TMSFNCObjectInspector1WritePropertyValue(Sender: TObject;
AObject: TObject; APropertyInfo: TTMSFNCPropertyInfo; APropertyName: string;
APropertyType: TTypeKind; var APropertyValue: string; var ACanWrite: Boolean);
begin
if APropertyName = 'Caption' then
APropertyValue := Trim(APropertyValue);
end;
void __fastcall TForm1::TMSFNCObjectInspector1ReadProperty(TObject *Sender,
TObject *AObject, TTMSFNCPropertyInfo APropertyInfo, System::UnicodeString APropertyName,
System::Typinfo::TTypeKind APropertyType, bool &ACanRead)
{
ACanRead = APropertyName != "InternalToken";
}
void __fastcall TForm1::TMSFNCObjectInspector1WritePropertyValue(TObject *Sender,
TObject *AObject, TTMSFNCPropertyInfo APropertyInfo, System::UnicodeString APropertyName,
System::Typinfo::TTypeKind APropertyType, System::UnicodeString &APropertyValue, bool &ACanWrite)
{
if (APropertyName == "Caption")
APropertyValue = Trim(APropertyValue);
}