Einzelnen Beitrag anzeigen

ratloser

Registriert seit: 4. Mai 2005
Ort: Linz
36 Beiträge
 
#1

VirtualStringTree und Incremental-Search

  Alt 10. Dez 2005, 20:02
Hallo an alle!

Ich bräuchte wieder mal Eure Hilfe!

Ich bin im Umgang mit VirtualStringTree nicht sehr geübt, das was ich bisher gebraucht habe, Aufbau eines Trees mit Subnodes, Füllen mit Daten, Anpassen der Optik etc. funktioniert schon recht gut, ich versteh zwar nicht alles, aber Hauptsache es funzt.

Nun wollte ich eine Suche mittels Incremental-Search einbauen, aber jetzt weiss ich nicht mehr weiter.

Delphi-Quellcode:
procedure TKalk.vstIncrementalSearch(Sender: TBaseVirtualTree;
  Node: PVirtualNode; const SearchText: 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 := SearchText;
  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
Nun meine Fragen: Wenn ich das so reinstelle, und einfach mal starte, bringt er die Meldung:

Delphi-Quellcode:
[Fehler] Hauptkalkulation.pas(1990): Undefinierter Bezeichner: 'PropertyTexts'
[Fehler] Hauptkalkulation.pas(1990): Undefinierter Bezeichner: 'ptkText'
[Fehler] Hauptkalkulation.pas(1995): Undefinierter Bezeichner: 'Min'
Meine Frage nun, warum findet er PropertyTexts nicht, ist das gesondert zu definieren?
Was soll in PropText stehen?
Was soll in Node.Parent.Index stehen, was in Node.Index und was in ptkText???

Lacht nicht, aber ich bin noch Anfänger.

Danke für Eure Bemühungen.

Ratloser (kann man wahrscheinlich nicht sein)
  Mit Zitat antworten Zitat