TFormControlInspectorEditLink allows to use any TWinControl based edit control that is placed on the form as inplace editor for the TInspectorBar.
To start using TFormControlInspectorEditLink, drop an instance on the form and also an instance of the edit control you want to use as inplace editor. Assign this control to TFormControlInspectorEditLink.Control. Then hook up the EditLink to TInspectorItem.EditLink and set TInspectorItem.PropertyType to ptCustom. Implement minimum the TFormControlInspectorEditLink.OnGetEditorValue / TFormControlInspectorEditLink.OnSetEditorValue events to get & set the value of the TInspectorItem as text from the control value.
To use a TAdvSearchEdit control as inplace editor for a TInspectorBar item, that performs filtering / lookup while typing in a dictionary, following code can be used applied on a default TInspectorBar:
procedure TForm1.FormCreate(Sender: TObject);
var
sl: TStringList;
i: integer;
begin
AdvSearchEdit1.SearchButton.Visible := false;
AdvSearchEdit1.CategoryButton.Visible := false;
AdvSearchEdit1.DropDownHeader.Visible := false;
// loading the dictionary file in the TAdvSearchEdit
sl := TStringList.Create;
try
sl.LoadFromFile(''e:\tms\temp\dictionary.txt'');
AdvSearchEdit1.LoadStrings(sl);
finally
sl.Free;
end;
// linking up the TAdvSearchEdit as inplace editor
FormControlInspectorEditLink1.Control := AdvSearchEdit1;
// inplace editor control will still hanbdle return key
FormControlInspectorEditLink1.WantKeyReturn := true;
InspectorBar1.Panels[0].ItemHeight := 26;
InspectorBar1.Panels[0].Style := psProperties;
for i := 0 to InspectorBar1.Panels[0].Items.Count - 1 do
begin
InspectorBar1.Panels[0].Items[i].EditLink := FormControlInspectorEditLink1;
InspectorBar1.Panels[0].Items[i].PropertyType := ptCustom;
end;
end;
procedure TForm1.FormControlInspectorEditLink1GetEditorValue(Sender: TObject;
Item: TInspectorItem; var AValue: string);
begin
AValue := AdvSearchEdit1.Text;
end;
procedure TForm1.FormControlInspectorEditLink1SetEditorValue(Sender: TObject;
Item: TInspectorItem; AValue: string);
begin
AdvSearchEdit1.Text := AValue;
end;