[Lazarus] VirtualTreeView bug

luiz americo pereira camara luizmed at oi.com.br
Thu Oct 18 17:21:07 CEST 2012


2012/10/18 ik <idokan at gmail.com>

> Hello,
>
> I'm trying to figure out why this keep on existing on VT from CCR
> virtualtree-new .
>


A new release is already done (just i could not upload to Lazarus-ccr) so
maybe is already fixed.

Anyway you can send the complete project here so i can test

Luiz


>
> 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
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20121018/47fd3d79/attachment-0003.html>


More information about the Lazarus mailing list