|
Filtering the properties
TComponentInspector has an advanced filtering feature. By default the filtering is used for switching between properties and events mode, but this can be changed or improved using OnFilter event. In the following example the user can switch the filtering between "all properties" (default filtering), "string properties", "integer properties" and "boolean properties" modes by the radio group component. The RefreshList method of the inspector must be called to apply changes and we do it in the OnClick event of the radio group component.
procedure TMainForm.ComponentInspectorFilter(Sender: TObject;
Prop: TProperty; var Result: Boolean);
begin
// we analyse the TypeKind of the passed property;
// when RadioGroup.ItemIndex is 0 ("all properties")
// we use the default filtering (Result is not changed)
with Prop do
case RadioGroup.ItemIndex of
1: Result:=TypeKind in [tkString,tkLString,tkWString];
2: Result:=TypeKind in [tkInteger];
3: Result:=PropType=TypeInfo(Boolean);
end;
end;
procedure TMainForm.RadioGroupClick(Sender: TObject);
begin
ComponentInspector.RefreshList;
end;
Any properties of the passed Prop can be analysed and any property of the edited component can be hidden and shown.
|