Element Size Mode

When a tp.Component instance is an element resize listener, by setting its IsElementResizeListener property to true, it gets notifications when its size changes.

When a tp.Component gets a notification about a size change it decides whether that size change dictates a SizeMode change too, based on its SizeChart. The SizeChart is a configurable number array containing 5 breakpoint values, one for each upper bound before the final largest mode.

There are 6 size modes: XSmall, Small, Medium, Large, XLarge, and XXLarge. The XXLarge mode needs no breakpoint, since it means any width greater than the XLarge upper bound.

When an element resize listener tp.Component changes SizeMode, it calls the ParentSizeModeChanged() method of all of its direct tp.Component children, providing a chance to adapt to the SizeMode change.

The tp.Row class is a tp.Component with its IsElementResizeListener property set to true. That is, a tp.Row is an element resize listener and a SizeMode change propagator.

The tp.Col class gets notified every time its tp.Row parent detects a SizeMode change and adjusts its width according to its WidthPercents number array property. The WidthPercents array contains 6 numbers, one for each supported SizeMode.

In short, the parent tp.Row detects a SizeMode, propagates the change to its tp.Col children, and each tp.Col adjusts its width.

Column 1
Column 2
Column 3
Column 4
Drag the splitter or use the buttons to resize the row. The row detects its own width mode and each column adjusts its width.