Setting caption for Virtual Tree List nodes

I can't understand the process described in documentation. It says to use event:

procedure TForm1.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
                Column: Integer; TextType: TVSTTextType; var CellText: WideString);
var
    Data: PTreeData;
begin
   Data:=VST.GetNodeData(Node);
   CellText := Data^.FCaption;
end;

How do I do that? I can't redeclare it just like this. When I double click on Tree List OnGetTextEvent it throws some exception at me "Property and Method are incompatible"


You don't mention the Delphi and VirtualTreeview version but I guess thats because of the CellText: WideString parameter - it should be of string type now after the UnicodeString became the default string type in Delphi. IOW change it to

procedure TForm1.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
          Column: Integer; TextType: TVSTTextType; var CellText: string);

There was something wrong with my project. I'm not sure what, cos I've recreated it. Now the GetText event works properly. My code above works.

链接地址: http://www.djcxy.com/p/35016.html

上一篇: Delphi XE3试图释放FSQL时无效指针(TStringList)

下一篇: 为虚拟树列表节点设置标题