Performance lag in TTMSFMXTableViewEx

In my Android app I use a TableView as the main view with a list of items; the rightrectangle has been customized to display 4 labels each, two with text and two with colors.


When I tap the item it displays the detailview quickly, a TFrame with many controls on it. However when I tap the back button to return to the main tabview item list display, it takes 3-5 seconds before the display appears.

At first I thought it might have something to do with data gathering, but I don't refresh the items at this point, I only execute this code:

procedure TForm1.TableViewBackButtonClick(Sender: TObject; AItem: TTMSFMXTableViewItem);
begin
  TableView.HeaderText := IIF(TableView.HeaderText = 'Items','Detail','Items');
end;

In other words, I change the TableView header text to a context relevant caption.

Are there any special tricks that I can do to speed up this display? Any properties I can look at changing that might be slowing this down? Is this just a screen drawing overhead issue?

Thanks.

My apologies, I didn't realize that the TableViewItemCustomize event fires when you return from the detail screen. I have a lot of code there for customizing the display. However it executes very quickly even in debug mode.


Anything to watch out for in my code? Can I bypass the ItemCustomize event when I return from the Detail screen?

Thanks.

Hi, 


The performance is highly susceptible by the amount of elements inside an item. I would try to reduce the amount of items to a mimimum. Is it really necessary to add 4 labels to the right-rectangle? Can you perhaps add a TPaintBox and draw 4 labels instead?

What should be the parent of this paintbox? One of the contained rectangles like rightrectangle? Or the Item rectangle itself? Why the paint box? Is it faster? How do I know I won't have the same performance issues with the paintbox?


I do need the labels, but I thought that since they are 2 dimensional text controls with a background color that they would be low impact...

Thanks.

What about using a TTMSFMXHTMLText object, one per row, and drawing an HTML table? Would that be just as slow, or faster but still too slow?

If you do not need HTML, I would suggest to only use one TText element or TLabel and then add a multiline text separated with #13#10. The slowness is most likely created due to the already high number of elements inside a single item. It's inclear if the performance increases if you use a single TTMSFMXHTMLText, it depends on the amount of information and text. The TTMSFMXHTMLText already switch automatically to a TText rendering, if there are no HTML tags detected so you could safely use a TTMSFMXHTMLText, but use the #13#10 instead of the <br> tags for multiple lines.