[Lazarus] VirtualTreeView bug
ik
idokan at gmail.com
Thu Oct 18 16:50:42 CEST 2012
Hello,
I'm trying to figure out why this keep on existing on VT from CCR
virtualtree-new .
The problem is that it display only the first char instead of the whole string.
My code:
------------------
....
type
PTreeData = ^TTreeData;
TTreeData = record
Column1,
Column2,
Column3 : String;
end;
procedure TForm1.FormCreate ( Sender : TObject ) ;
var
Column : TVirtualTreeColumn;
i : integer;
begin
Randomize;
VST.Header.Options := VST.Header.Options +[hoVisible];
VST.Header.Style := hsFlatButtons;
for i := 1 to 3 do
begin
Column := VST.Header.Columns.Add;
Column.Text := 'column #' + IntToStr(i);
Column.Options := Column.Options + [coAllowClick, coResizable];
Column.Width := UTF8Length(Column.Text) + 100;
end;
VST.TreeOptions.MiscOptions := VST.TreeOptions.MiscOptions +
[toEditable,toGridExtensions];
VST.TreeOptions.SelectionOptions := VST.TreeOptions.SelectionOptions +
[toExtendedFocus, toMultiSelect];
end;
procedure TForm1.btnAddRootClick ( Sender : TObject ) ;
Var
Data : PTreeData;
XNode : PVirtualNode;
Rand : Integer;
begin
Rand := Random(99);
XNode := VST.AddChild(nil);
if VST.AbsoluteIndex(XNode) > -1 then
Begin
Data := VST.GetNodeData(XNode);
Data^.Column1 := 'One ' + IntToStr(Rand);
Data^.Column2 := 'Two ' + IntToStr(Rand + 10);
Data^.Column3 := 'Three ' + IntToStr(Rand - 5);
End;
end;
procedure TForm1.VSTChange ( Sender : TBaseVirtualTree; Node : PVirtualNode ) ;
begin
VST.Refresh;
end;
procedure TForm1.VSTFocusChanged ( Sender : TBaseVirtualTree;
Node : PVirtualNode; Column : TColumnIndex ) ;
begin
VST.Refresh;
end;
procedure TForm1.VSTGetNodeDataSize ( Sender : TBaseVirtualTree;
var NodeDataSize : Integer ) ;
begin
NodeDataSize := SizeOf(TTreeData);
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 := Data^.Column1;
1 : CellText := Data^.Column2;
2 : CellText := Data^.Column3;
end;
end;
procedure TForm1.VSTNewText ( Sender : TBaseVirtualTree; Node : PVirtualNode;
Column : TColumnIndex; NewText : WideString ) ;
var
Data : PTreeData;
begin
Data := VST.GetNodeData(Node);
case Column of
0 : Data^.Column1 := NewText;
1 : Data^.Column2 := NewText;
2 : Data^.Column3 := NewText;
end;
end;
...
-------------------------
Any ideas why it happens and how to solve this ?
Thanks,
Ido
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vt.png
Type: image/png
Size: 12548 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20121018/71194774/attachment-0002.png>
More information about the Lazarus
mailing list