MobileTableCustomCell control sizes

When are the sizes of the various controls within a MobileTableCustomCell set?
When the object is created, it may not yet be displayed in a table, so any calculations based on object sizes are wrong.

The Opening event never fires, and there is no appeared.

In my case I have an image that I want to fit the width of a cell, and then modify the height constraint to scale appropriately. I can’t seem to find any way to do this at all.


So the thing about constraints is that you can’t really control when they are calculated. Your best bet will be to do all the constraint work in a method and call it when you set up the cell. You’ll want to set the height constraint to be a percentage of the width constraint.

Thr problem with that is there is no way to know when the constraint is applied.
If you have a graphic that should paint with its size relative to other objects in the cell, it may paint before those have resolved. It would be easy enough to have it redraw when the cell was shown or after the sizes were established but there is no way to identify that thr cell has become “ready”.

Assuming you are using a DataSource, you would do all of these calculations in the RowData event when retrieving the data to be shown and then call the method I described to set up the constraints.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.