On Thursday 20 October 2016 18:25:08 Martin Schreiber wrote:

> It is possible to add dynamic position and size correction to
> ListItemLayoutInfoTy like ListItemLayoutInfoTy.Variable.Extra.Image but it
> is not cheap. I still don't really understand the purpose, please explain
> again.
>
I did it anyway, it is not *so* expensive, git master 
087ec4683f11938ddd22259cf48662c2931250ae

"
procedure trootnode.drawimage(var alayoutinfo: listitemlayoutinfoty;
               const acanvas: tcanvas);
var
 info1: drawtextinfoty;
begin
 inherited;
 with alayoutinfo do begin
  if variable.calcautocellsize then begin
   variable.extra.caption.cx:= -acanvas.getstringwidth('abc');
  end
  else begin
   fillchar(info1,sizeof(info1),#0);
   info1.text.text:= 'abc';
   info1.dest:= captioninnerrect;
   info1.clip:= captionrect;
   info1.flags:= [tf_ycentered,tf_right,tf_clipo];
   drawtext(acanvas,info1);
   variable.extra.caption.cx:= info1.res.x - (captionrect.x + captionrect.cx);
  end;
 end;
end;
"

And while implementing I remembered "updatecaption()". ;-)

So another solution is:
"
procedure trootnode.drawimage(const acanvas: tcanvas;
                      var alayoutinfo: listitemlayoutinfoty);
begin
 inherited;
 if not alayoutinfo.variable.calcautocellsize then begin
  with alayoutinfo do begin
   drawtext(acanvas,'abc',captionrect,captioninnerrect,
                                     [tf_clipo,tf_ycentered,tf_right]);
  end;
 end;
end;

procedure trootnode.updatecaption(const canvas: tcanvas;
             var alayoutinfo: listitemlayoutinfoty; var ainfo: 
drawtextinfoty);
var
 i1: int32;
begin
 inherited;
 i1:= canvas.getstringwidth('abc');
 dec(ainfo.dest.cx,i1);
 dec(ainfo.clip.cx,i1);
end;
"

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