The TSubForm table component allows to show or hide a sub form for a data record row. A new sub form instance will be created for each row so the different sub forms can be edited independently. The data record placement in the sub form gets not lost after a row change or after hiding and displaying them.
The example (s. Fig. 142)
shows a SScrollTable, which has a TSubFrom
component configured which displays a sub form.
The TSubForm component can be configured by editing the TableColumnDefinition
property within the SScrollTable.
Just select or add a new column in the TableColumnDefinition editor and click at it. Than
select TSubForm component from the Editor field. Afterwards
just click at the
button for opening
the TSubForm properties dialog for editing.
The register Database contains all properties needed for
the sub form setup.
The SubForm property allows to specify which form should be loaded
as a sub form instance into the SScrollTable. The property SubFormRowHeight
allows to specify the height of the sub form row in the SScrollTable.
For displaying the correct data record for the table row, filters can be specifies using the
properties LinkChildFields and LinkMasterColumns.
The property LinkMasterColumns specifies the columns of the table
which contains the data to be filtered in the sub form. The property LinkChildFields
specifies the component/s containing the value to be filtered for.
The example (s. Fig. 142)
uses the column ID as LinkMasterColumns and the component txt_id
within the sub form as LinkChildFields. The sub form display only that records
which matches to the value within the ID column.
While using sub forms pleas keep in mind that the component names should be unambiguously. If an STableElement in the sub form has the same name as a STableElement in the main form, the filter setup could fail beacuse the setup is possibly performed at the wrong component.