|
Sorting the properties
By default all properties in the inspector are sorted in the alphabetical order, but the order can be changed by OnCompare event. In the following example the user can sort items by name or by type using 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.ComponentInspectorCompare(Sender: TObject;
Prop1, Prop2: TProperty; var Result: Integer);
begin
if RadioGroup.ItemIndex=1 then
if Integer(Prop1.PropType)<Integer(Prop2.PropType) then Result:=-1
else
if Integer(Prop1.PropType)>Integer(Prop2.PropType) then Result:=1;
end;
procedure TMainForm.RadioGroupClick(Sender: TObject);
begin
ComponentInspector.RefreshList;
end;
|