|
Adding and customizing the drop-down list
TComponentInspector allows to display the drop-down list with the possible values for each property and change the list contents. The follow example demonstrates adding the drop-down list for the Caption property of the form. First of all, we have to add the drop-down button by OnGetButtonType event.
procedure TfrmMain.ComponentInspectorGetButtonType(Sender: TObject;
TheIndex: Integer; var Value: TButtonType);
begin
with ComponentInspector do
if Assigned(Properties[TheIndex]) and
(Properties[TheIndex].Name='Caption') then Value:=btDropDown;
end;
Now just fill the drop-down list using OnGetValuesList event.
procedure TfrmMain.ComponentInspectorGetValuesList(Sender: TObject;
TheIndex: Integer; const Strings: TStrings);
begin
with ComponentInspector do
if Assigned(Properties[TheIndex]) and
(Properties[TheIndex].Name='Caption') then
Strings.Text:='Caption 1'#13'Caption 2'#13'Caption 3';
end;
|