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

FillInData pData

- 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"]
end FillInData

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
end FillInData

LayoutControl pControlRect

- 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.

Example:

on LayoutControl pControlRect
   set the rect of field "FirstName" to pControlRect
end LayoutControl

The following custom properties are available to your template behavior scripts by default

dgLine

- The line (or row) number that is being displayed in the copy of the template.

dgIndex

- The index used to uniquely identify the record being displayed in the copy of the template.

dgColumn

- 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.

dgColumnNumber

- 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

dgDataControl (getProp)

- 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.

1 Comments

Simon

I visited this page wanting to know when the messages fillinData and LayOutControl get called. LayOutControl appears to be called every time a row is scrolled into view which can cause some unexpected side effects. I have found that the IDE's message watcher is unreliable when working with datagrids which is why I am asking.

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.