2016-10-20 8:57 GMT+02:00 Martin Schreiber <mse00...@gmail.com>:
>
> git master db394652aced3fc3ad32363c096eb22fe2d78e9f calls the class from
> itemlist.itemclass parameter.
> You probably don't need to use calcitemlayout(), it is called only one
> time.
> Its main purpose is to handle different layouts for normal and
> tree-listitems.
> Overriding ttreelistitem.drawimage() and updating the variable values
> of "alayoutinfo" should be enough. How should the cells look?


calcitemlayout is still not called (even once) but I tried with drawimage:

procedure TRootNode.drawimage(var alayoutinfo: listitemlayoutinfoty;
  const acanvas: tcanvas);
var
 w: Integer;
begin
  w := acanvas.getstringwidth('abc');
  alayoutinfo.captionrect.cx := alayoutinfo.captionrect.cx-30;
  alayoutinfo.captioninnerrect.cx := alayoutinfo.captioninnerrect.cx-30;
  alayoutinfo.minsize.cx := alayoutinfo.minsize.cx+30;

  inherited drawimage(alayoutinfo, acanvas);

  alayoutinfo.captionrect.cx := alayoutinfo.captionrect.cx+30;
  alayoutinfo.captioninnerrect.cx := alayoutinfo.captioninnerrect.cx+30;
  alayoutinfo.minsize.cx := alayoutinfo.minsize.cx+30;


drawtext(acanvas,'abc',alayoutinfo.captioninnerrect,[tf_ycentered,tf_right]);
end;

My 'abc' is drawed properly but offset is not working (standard caption is
drawing over my text). 'w' has correct value. Also if I select treeitem I
get error in tcanvas.getstringwidth, line checkgcstate. If I comment
`getstring` then second exception is in 'drawtext' line 'if
cs_internaldrawtext in fstate'. Tried same trick in drawcell:

procedure TRootNode.drawcell(const acanvas: tcanvas);
var
 po1: pcellinfoty;
 layoutinfopo: plistitemlayoutinfoty;
 w: Integer;
begin
  po1 := pcellinfoty(acanvas.drawinfopo);
  layoutinfopo := getownerintf.getlayoutinfo(po1);
  w := acanvas.getstringwidth('abc');
  layoutinfopo^.captioninnerrect.cx := layoutinfopo^.captioninnerrect.cx-w;
  inherited drawcell(acanvas);
  layoutinfopo^.captioninnerrect.cx := layoutinfopo^.captioninnerrect.cx+w;

drawtext(acanvas,'abc',layoutinfopo^.captioninnerrect,[tf_ycentered,tf_right]);
end;

Here everything is working as expected, except that if I select treeitem
then my extra text is not drawed.
I just want simple treeview report with one column + extra text on right
side which deal with caption's 'right ellipsis' text flag. Actually I could
solve this by adding second data column and hidding header and vertical
grid lines but must check how it will work with splitter (my treeview's
width can be changed by splitter so the extra text / column should be
"anchored" to right edge). Incremental search is not needed for me, I have
dedicated TEdit for filtering treeview content and this is what users will
mostly use
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to