View Issue Details

IDProjectCategoryView StatusLast Update
0002983JEDI VCL00 JVCL Componentspublic2005-05-24 06:46
ReporterwestphalAssigned ToAHUser 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0002983: jvAutoComplete
DescriptionAdded feature

Possibility to change the searched part of the autocomplete using a new assigned property: OnGetSearchPart

usefull if you wish to be able to enter in an edit box, multiple items
Additional InformationUsage exemple:

  FAutoComplete := TJvEditListAutoComplete.Create(edRecipients,FDirectoryList);
  FAutoComplete.OnGetSearchPart:=GetSearchPart;



function TForm1.GetSearchPart(sender : TObject; anItem : string) : string;
var p : integer;
begin
  result:=anItem;
  p:=lastDelimiter(';',anItem);
  if p<>0 then delete(result,1,p);
  result:=TrimLeft(result);
end;
TagsNo tags attached.

Activities

2005-05-23 05:03

 

JvAutoComplete.pas (28,514 bytes)

AHUser

2005-05-23 05:16

developer   ~0007301

I have added the feature. But I've renamed the event to "OnGetSearchPrefix".

Added to CVS.

westphal

2005-05-24 05:37

reporter   ~0007332

Hello, whoaho it was fast ! Thanks

But my proposition contained also a modification of the selectItem proc in the procedure Autocomplete in order to not replace the full content of the control, with that modification, you can add sevral items in an edit box

Here is an adapted version of this procedure:


  function SelectItem(const AnItem: string): Boolean;
  var
    Idx: Integer;
    ValueChange: Boolean;
    partToFind : string;
  begin
    partToFind:=anItem;
    GetSearchItemPrefix(partToFind);

    if partToFind = '' then
    begin
      Result := False;
      SetItemIndex(-1);
      DoChange;
      Exit;
    end;
    Idx := FindItemPrefix(-1, partToFind);
    Result := (Idx <> -1);
    if not Result then
      Exit;
    ValueChange := Idx <> GetItemIndex;
    SetItemIndex(Idx);
    if ListSearch then
    begin
      SetItemIndex(Idx);
      FFilter := partToFind;
    end
    else
    begin
      SetText(AnItem + Copy(GetItemAt(Idx), Length(partToFind) + 1, MaxInt));
      SetEditSel(Length(AnItem), Length(GetText));
    end;
    if ValueChange then
      DoValueChange;
  end;

AHUser

2005-05-24 06:46

developer   ~0007333

Fixed in CVS.

Issue History

Date Modified Username Field Change
2005-05-23 05:01 westphal New Issue
2005-05-23 05:03 westphal File Added: JvAutoComplete.pas
2005-05-23 05:16 AHUser Status new => resolved
2005-05-23 05:16 AHUser Resolution open => fixed
2005-05-23 05:16 AHUser Assigned To => AHUser
2005-05-23 05:16 AHUser Note Added: 0007301
2005-05-24 05:37 westphal Status resolved => feedback
2005-05-24 05:37 westphal Resolution fixed => reopened
2005-05-24 05:37 westphal Note Added: 0007332
2005-05-24 06:46 AHUser Status feedback => resolved
2005-05-24 06:46 AHUser Resolution reopened => fixed
2005-05-24 06:46 AHUser Note Added: 0007333