Template Custom Properties & Messages
When you are coding behaviors for custom templates the following properties and messages are applicable.
The Following Messages Are Sent To Your Custom Templates
- The FillInData message is where you move data for a row or column into the controls for that row or column. Normally you will just assign data to controls in the template. You most likely will not resize any of the controls at this point.
If your data grid is of type "form" then pData will be an array holding the row values. If your data grid is of type "table" then pData is the value for the column that is being populated.
Data Grid row example:
on FillInData pDataA
## Assign FirstName value to the "FirstName" field of this row template
set the text of field "FirstName" of me to pDataA["FirstName"]
Data Grid table example:
on FillInData pData
## Assign Column value to field 1 of this column template
set the text of field 1 of me to pData
- LayoutControl is sent to your custom template when it is time to position all of the controls. pControlRect is the rectangle that the data grid has resized your control to. This is useful for knowing the left (item 1 of pControlRect), top (item 2 of pControlRect), right (item 3 of pControlRect) and bottom (item 4 of pControlRect) bounds you can position controls at. Note that if you have a data grid form that does not have fixed height set to true then you can ignore the botom (item 4 of pControlRect) and make your control as tall as you need.
on LayoutControl pControlRect
set the rect of field "FirstName" to pControlRect
The following custom properties are available to your template behavior scripts by default
- The line (or row) number that is being displayed in the copy of the template.
- The index used to uniquely identify the record being displayed in the copy of the template.
- When working with a data grid table you can use the dgColumn of me in a custom template behavior to get the name of the column the instance of the template is associated with. To use this property in other scripts you use the target or the mousecontrol as the target as well.
- When working with a data grid table you can use the dgColumnNumber of me in a custom template behavior to get the column number relative to all visible columns. To use this property in other scripts you use the target or the mousecontrol as the target as well.
The following custom properties are defined in the behavior script for your template
- Your template should 'return the long id of me' in this getprop handler. This helps the data grid identify your row template. THIS IS REQUIRED FOR YOUR DATA GRID TEMPLATE TO WORK PROPERLY!!
dgHilite pBoolean (setProp)
- This property is set by the data grid to set the highlighted state of the row or column control. If pBoolean is "true" then the control should be highlighted. If "false" then it should not be.