trigger Column_Resized
Interactive trigger that handles processing when the selected column is resized.
trigger Column_Resized
params
String columnName : in
numeric viewportWidthPx : in
string columnWidthsPx : in
endparams
; <Your code here>
end; trigger Column_Resized
Applies to: | Form widgets: egrid (Grid) |
Activation: | Activated when the user resizes the column
width with the mouse, or when a column is made visible with the $columnsyntax
function. It is not fired when the size is changed with the columnwidth entity property. |
Default behavior: | None |
Behavior upon completion: | None |
Parameters
- columnName—fully-qualified field name of the resized column.
- viewportWidthPx—viewport
width, in pixels.
Note: The viewport is considered to be all the visible content of the grid, excluding the row headers, columns headers, and scroll bar.
- columnWidthsPx—Uniface
list of column-width pairs, excluding the hidden columns. List items are formatted as follows using
GOLD ; as the separator:
Columnname=Pixels {;Columnname=Pixels}
Changing the Column Width
The following ProcScript changes the column width of a column that was not resized to fit the view port.
trigger Column_Resized params string columnName : in numeric viewportWidthPx : in string columnWidthsPx : in endparams variables string col1, col2, name1, name2, colWid, entProp numeric width1, width2 endvariables ; get first column info. col1 = $itemnr(1, columnWidthsPx) name1 = $idpart(col1) width1 = $valuepart(col1) ; get second column info. col2 = $itemnr(2, columnWidthsPx) name2 = $idpart(col2) width2 = $valuepart(col2) ; change the column width to fit the view port. if (columnName = name1) width2 = viewportWidthPx - width1 else width1 = viewportWidthPx - width2 endif ; create the column list. putitem/id colWid, name1, "%%width1%%%px" putitem/id colWid, name2, "%%width2%%%px" ; get current entity properties. entProp = $entityproperties(ENT.MYMODEL) ; delete the current columnwidth property. delitem/id entProp, "columnwidth" ; add the new columnwidth property. putitem/id entProp, "columnwidth", colWid ; set entity properties. $entityproperties(ENT.MyMODEL) = "%%entProp" end ; trigger Column_Resized