On Wednesday 19 October 2016 16:38:14 Krzysztof wrote:
> 2016-10-19 9:08 GMT+02:00 Martin Schreiber <mse00...@gmail.com>:
> > Override "calcitemlayout()".
>
> Mmm, seems that this methods is never called:
>
Because of:
"
function ttreeitemedit.getitemclass: listitemclassty;
begin
 result:= ttreelistedititem;
end;
"
instead to get the actual class from itemlist. I'll need to check it.

> Nothing changed, also breakpoint doesn't work here.

If the layout must be changed dynamically probably it is the best to make the 
adjustments in drawcell() and to restore the original values afterwards.
"
procedure trootnode.drawcell(const acanvas: tcanvas);
var
 po1: pcellinfoty;
 layoutinfopo: plistitemlayoutinfoty;
begin
 po1:=  pcellinfoty(acanvas.drawinfopo);
 layoutinfopo:= getownerintf.getlayoutinfo(po1);
 dec(layoutinfopo^.captionrect.cx,40);
 dec(layoutinfopo^.captioninnerrect.cx,40);
 inherited;    
 inc(layoutinfopo^.captionrect.cx,40);
 inc(layoutinfopo^.captioninnerrect.cx,40);
end;
" (not tested).

There is also TTreeItemEdit.OnExtendImage which can be used to set 
the "imageextra" size of the layout before drawcell() will be called.

> Second question for
> this case: How to instead of hardcoded '40' set it dynamically for example
> textsize('abc').cx. I guess that I need access to canvas but don't know how
> to get it from that place

An asynchronous canvas for font size calculation is available by 
TWidget.GetCanvas(). The accompanied grid is available in calcitemlayout() 
by "tcustomitemlist1(list).fintf.getgrid()", git master 
a739134b044cb2bffff924a21383b597654abfdb has "tcustomitemlist.itemlistintf" 
property for convenience.

Martin

------------------------------------------------------------------------------
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