Property Integer piWidth
| Read Access: | Get piWidth to IntegerVariable |
| Write Access: | Set piWidth to IntegerVariable/Value |
A column's actual width is related to the grid's pbAutoColumnsizing property and the column's pbResizable property. When pbAutoColumnSizing or pbResizable is set to False, then piWidth specifies the actual width of the column in pixels.
When pbAutoColumnSizing and pbResizable are set to True, then each resizable column's width value is compared and applied as a ratio of the available width of the grid.
For example, let's say a grid has 3-columns A,B & C as follows:
Object oColumnA is a cCJGridColumn
Set piWidth to 10
End_Column
Object oColumnB is a cCJGridColumn
Set piWidth to 20
End_Column
Object oColumnC is a cCJGridColumn
Set piWidth to 30
End_Column
If, in the above example, the grid's width is 240 pixels and pbAutoColumnSizing is set to True, then the actual width of each column in pixels would be: A=40, B=80 & C=120 pixels as per the relative column size ratios specified by piWidth.
If, on the other hand, pbAutoColumnSizing is set to False, then the column widths would be: 10, 20 & 30 pixels as specified by piWidth. The remaining width of the grid would be left empty.
Default is 0.
To specify the minimum column width set the column's piMinimumWidth property.
To prevent the user from resizing a column set the column's pbResizable property to False.
When source code changes are made in a grid, the restored layout may interfere with those changes. When this happens, changes made to the grid and its columns will not appear because the old settings are being restored. The grid class attempts to recognize when such a change has occurred by checking if the number of columns has changed. If it has, the previous setting will not be restored. This only catches a small number of the possible changes and it is quite likely that it will not recognize that a change has actually occurred. When this occurs, it will appear that the grid is ignoring your source code changes. The number of columns that appear may be wrong, the ordering and size of the columns may be wrong and some of the grid alignment settings will be wrong.
If this happens, you must tell the system that the menu layout has changed. You can do this by changing (i.e., incrementing) the build number of the grid system by setting the piLayoutBuild property.
During development, it is probably best to disable the loading and saving of the grid's environment. Set pbRestoreLayout of the grid object to False to turn off restore layout for a grid, or set pbPreserveEnvironment of the cApplication object to False to disable restore layout for your entire application.