Menu

TTableItem and dynamic height

2013-10-18
2013-10-19
  • Pierre Moati

    Pierre Moati - 2013-10-18

    Hello,
    I'm using TDPFUITableView, and I want to create dynamic height for each TTableItem.
    I need to draw the cell by using OnDrawCell, and I declare in the objects :

        text := TDPFLabel( Objects[1] );
        text.Position.x    := 8;
        text.Position.Y    := 25;
        text.NumberOfLines := 0;
        text.Width         := title.Width;
        text.LineBreak     := lbWordWrap;
        text.Text          := TableItem.ItemDescription.Text;
        text.sizeToFit();
    

    With NumberOfLines and sizeToFit, the text is OK, but it crop, because the height of the parent (TTableItem ?) has not the good size.

    Is there a way to do that ? I think the size of the cell should be fill before the OnDrawCell, but I don't know how to calculate the height of my text, and my TDPFLabel is declare in the onDrawCell, not in the onGetRownHeight...

    thank you for your help

     

    Last edit: Pierre Moati 2013-10-18
  • Babak Yaghoobi

    Babak Yaghoobi - 2013-10-19

    Hi Pierre

    Download last source [code] and see TableViewAutoHeight demo

    regards

     

    Related

    Code: code

  • Pierre Moati

    Pierre Moati - 2013-10-19

    Thank you.
    I process something similar by my way (with a lot of difficulty), but your code is more nice than mine :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.