Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi VST / IncrementalSearch (https://www.delphipraxis.net/46999-vst-incrementalsearch.html)

ucor 4. Jun 2005 18:11


VST / IncrementalSearch
 
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.

ucor 5. Jun 2005 16:37

Re: VST / IncrementalSearch
 
Hallo,

habe die Lösung gefunden.

Delphi-Quellcode:
procedure TSTF.VST2IncrementalSearch(Sender: TBaseVirtualTree;
  Node: PVirtualNode; const SearchText: WideString; var Result: Integer);
var
  s1,
  s2: string;
  Data: PTreeData;
begin
  Data:= VST2.GetNodeData(Node);
  s1 := SearchText;
  s2:= TTreeDataClass(Data.FObject).FName;
  Result := StrLIComp(PChar(s1), PChar(s2), Min(Length(s1), Length(s2)));
end;
Gruß U.

generic 6. Jun 2005 20:25

Re: VST / IncrementalSearch
 
hättest du hier mal dp gesucht dann hättest du sogar was VOR deinem post gefunden.


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:06 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz