I would like to implement a search procedure to a VirtualStringTree
and I would like to do it by comparing the search text with the text from node and not from the pointer (eg. Data^.Column0
) because this is not always as String
.
Please help me with a suggestion to get back the text from node as it is.
For a better understanding see bellow code (I adjust an example from Lazarus)
type
PTreeData = ^TTreeData;
TTreeData = record
Column0: TDate; //Date
Column1: Integer; //Integer
Column2: String;
end;
procedure TForm1.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
var
Data: PTreeData;
begin
Data := VST.GetNodeData(Node);
case Column of
0: CellText := DateToStr(Data^.Column0); //2015-05-11 or 11-05-2015
1: CellText := IntToStr(Data^.Column1) + ' days'; //22 days
2: CellText := Data^.Column2;
end;
end;
record
Column0AsText
which will be theData^.Column0AsText:= DateToStr(Data^.Column0)
and I will implement the search through the strings. – REALSOFO