trigger Viewport_Resized
Interactive trigger that handles processing whenever the Grid widget (excluding row headers, column headers, and scroll bars) is resized.
trigger Viewport_Resized
params
numeric widthPx : in
numeric heightPx : in
string columnWidthsPx : in
endparams
; <Your code here>
end; Viewport_Resized
Applies to: | Form widgets: egrid (Grid) |
Activation: | Activated when the Grid widget is resized. |
Default behavior: | None |
Behavior upon completion: | None |
Parameters
widthPx
—width of the grid's viewport 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.
heightPx
—viewport height in pixels excluding the column header, 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}
Using Viewport_Resized
The following ProcScript changes the column width of the second column, based on the viewport width.
Trigger Viewport_Resized params numeric widthPx : in numeric heightPx : in string columnWidthsPx : in endparams variables string col1, col2, name1, name2, colWid, entProp numeric width1, width2 endvariables ; first column stays the same width. col1 = $itemnr(1, columnWidthsPx) name1 = $idpart(col1) width1 = $valuepart(col1) ; second column fills the rest of the viewport. col2 = $itemnr(2, columnWidthsPx) name2 = $idpart(col2) width2 = widthPx - width1 ; create the column list. putitem/id colWid, name1, "%%width1%%%px" putitem/id colWid, name2, "%%width2%%%px" ; get current entity properties. entProp = $entityproperties(ENT.MODEL) ; delete the current columnwidth property. delitem/id entProp, "columnwidth" ; add the new columnwidth property. putitem/id entProp, "columnwidth", colWid ; set entity properties. $entityproperties(ENT.MODEL) = "%%entProp" end ; trigger Viewport_Resized