Dynamically Set the height of DataGrid

Bob Sneidar bobsneidar at iotecdigital.com
Mon Dec 10 10:43:41 EST 2018


    get the dgNumberOfRecords
    set the dgNumberOfRecords of group "DataGrid" to 20
    Getting the dgNumberOfRecords is the same as getting the dgNumberOfLines. Setting the dgNumberOfRecords has a special significance however. If you set the dgNumberOfRecords then you are telling the data grid that you know how many total records there are and you are going to supply the data for each record on an as-needed basis. This is useful when you have data in a database cursor that you would like to feed into the data grid.

row height

- For tables and forms whose 'fixed row height' property is true this represents the height that your rows will be drawn at. If this property is not set for a form whose 'fixed control height' is true then the record template group height is used. For forms whose 'fixed control height' is false this represents the height that alternating rows that contain no data will be drawn at.

So something like:

put the dgNumberOfRecords of group "DataGrid" into tNumberOfRecords
put the dgProp ["row height"] of group "DataGrid" into tRowHeight
Set the height of group "DataGrid" to min(12, tNumberOfRecords) * (tRowHeight) + 36 -- account for header and scrollbar

Bob S


More information about the use-livecode mailing list