Thema: Delphi VST / IncrementalSearch

Einzelnen Beitrag anzeigen

ucor

Registriert seit: 19. Apr 2005
18 Beiträge
 
#1

VST / IncrementalSearch

  Alt 4. Jun 2005, 18:11
Hallo,

Irgendwie komme ich mit der IncrementalSearch des VST nicht weiter.
Die Daten bekommt der VST aus einer Datenbank. IncrementalSearch steht auf isAll. Folgendes Beispiel aus den Advaned Demos von M.Lischke habe ich mir auch schon angesehen, komme damit aber auch nicht weiter, weil die Daten dort voher definiert werden und nicht aus einer DB kommen.

Delphi-Quellcode:
procedure TfrmProperties.VST3IncrementalSearch(Sender: TBaseVirtualTree; Node: PVirtualNode; const Text: WideString;
  var Result: Integer);

var
  S, PropText: string;


begin
  // Note: This code requires a proper Unicode/WideString comparison routine which I did not want to link here for
  // size and clarity reasons. For now strings are (implicitly) converted to ANSI to make the comparison work.
  // Search is not case sensitive.
  S := Text;
  if Node.Parent = Sender.RootNode then
  begin
    // root nodes
    if Node.Index = 0 then
      PropText := 'Description
    else
      PropText := 'Origin';
  end
  else
  begin
    PropText := PropertyTexts[Node.Parent.Index, Node.Index, ptkText];
  end;

  // By using StrLIComp we can specify a maximum length to compare. This allows us to find also nodes
  // which match only partially.
  Result := StrLIComp(PChar(S), PChar(PropText), Min(Length(S), Length(PropText)))
end;
Was muß ich nun anstelle von 'PropText' und 'Result' einsetzen?

Gruß U.
  Mit Zitat antworten Zitat