TTMSFMXTableView 3 Fields and 3 Lines in Desc


Getting closer to understanding tableviews. I would like to put more details in the description. There are several combinations I would like to use, but the simplest example would be to have some kind of smart editing that would combine address fields to show an address block under someone's name.

For instance
AddressLine1, AddressLine2, City, State, PostalCode, Country

I could create this in a calculated field, but there are other cases where I want to do this on the fly. How can I custom specify and format the text for the description? Including inserting html for anchor clicks or anything else? Which event would I use?


I tried it with a calculated field and have that currently working. I would still like to solve how to do it dynamically. But I am currently stuck on making the description multiple lines. So for one item the address has 3 lines:

     Scott Lynn
     123 Park Place
     Livonia, MI 44433

But another has 4 lines:

     Bill Gates
     Apt 223
     1 Billionaire Apartments Lane
     Seattle, WA 99233

Any maybe another has 5 lines or 2 lines. How do I set this programmatically for the tableview description presuming I know the number of lines in an integer variable?


Or even just make three lines visible?

So I figured out a little more on this, and I have a working solution for calculated fields using OnItemCustomize:

  sDetails := (AItem.Description);
  iLines := GetLineCount(sDetails) + 1;
  iLineHeight := AItem.ShapeDescription.Canvas.TextHeight('AygW');
  AItem.Shape.Height := AItem.ShapeCaption.Height + (iLines * iLineHeight);

This works well for everything I have thrown at it. I still don't know how to do it without calculated fields. But so far so good. Note, I am inserting '<BR>' in my calculated field for the line breaks.

- Scott


Thank you for your feedback on this. You can't avoid using calculated fields unfortunately, but this is a very nice suggestion we can investigate for future support.

I would like to minimize the amount of math I have to do in OnItemCustomize. Specifically parsing strings to find the number of lines - which is a wasteful activity and probably not the best idea on slower mobile devices.

I already know how many lines when I create the calculated field in my dataset OnCalcFields event. How can I store and access that integer value in OnItemCustomize?

- Scott


Each item has an AutoSize property, perhaps you could set this property in the OnItemCustomize event? There is unfortunately no way to store how many lines there are. If you have access to the item in the OnCalcFields event you can use one of the Data* properties but I suppose you do not have access yet in that event?