TTmsAdvEdit clear text after lookup


there is actually no way, to reset a TTmsAdvEdit control after a lookup.
Could you please add

property ClearTextAfterLookUp: Boolean read FClearTextAfterLookUp write FClearTextAfterLookUp;

and in "procedure TTmsAdvEdit.DoneLookup;" add the first two lines of the following code:

  if Self.ClearTextAfterLookUp then
    Text := ''
  else if FLookup.Multi then
    NewValue := NewValue + FLookup.Separator;
    LookupText := Text; // get current text value & strip till last lookup part
    NewText := '';
    while VarPos(FLookup.Separator, LookupText, vp) > 0 do
      NewText := NewText + Copy(LookupText, 1, vp);
      Delete(LookupText, 1, vp);
    Text := NewText + NewValue;
    Text := NewValue;

  if not Self.ClearTextAfterLookUp then begin
    if FLookup.Multi then
      SelStart := length(Text)

Thanks a lot :slight_smile:

I do not understand the purpose of this or the goal of what you try to accomplish?
Why would you want to reset the text from a valid lookup for example?

I have an edit field with lookup function. When I start typing, suggestions appear with names from the lookup list. When I select one of those suggestions, I add that record to a listbox with previously selected names. After the selection, the field for a new name should be emptied to lookup a new name.

I suggest to use OnLookupSelect and from this event set the Value param to empty string.

This did it! Sometimes the solution is easier than you first think. Thanks for the quick support. Have a nice day.