It appears that when I try to anchor together two controls with different parents LCL silently sets position to 0,0 and does not complain.
Firstly, if such anchoring is not possible it should either leave the control alone or raise an error. The current behaviour makes no sense.
If anchoring across different parents is possible I would be grateful to know how to make it work.
Here is what I am trying to do. I am open to suggestions for a better way to do it.
I am displaying multiple records of data from a database table. Nothing is known at compile time. The controls are all generated at runtime. I am not using a grid. The data may be tabulated either horizontally or vertically, and either fixed width scrollable or wrapped, depending on configuration.
Each field has a captioned header, which I want to stay visible even when the tabulated data is being scrolled. I will describe the situation where the data is tabulated with fields stretching horizontally, and records vertically, but in practice I want it to work for both.
My current approach is to do as follows:
Two nested scrollboxes. The outer scrollbox contains the headers above the inner scrollbox, the inner scrollbox contains the data. The outer scrollbox has only a horizontal scrollbar, the inner scrollbox has only a vertical scrollbar. This way when the tabulated data is larger than the window in both directions, scrolling horizontally moves both the data and the headers (keeping them aligned), while scrolling vertically scrolls only the data controls (keeping the headers visible).
I want to align the headers with the data columns. If necessary I can calculate this manually in event handlers, but it would be better to delegate the work to the library. But for this to work it needs to allow me to anchor the header captions (parent=outerscrollbox) to the corresponding data controls (parent=innerscrollbox).
Any suggestions gratefully received.