LiveCode LessonsLiveCode Data Grid Working With Data Grid TablesWhat If I Need to Work With htmlText, rtfText or unicodeText?

What If I Need to Work With htmlText, rtfText or unicodeText?

By default all table columns will have their text property assigned. If you need to work with unicode, htmltext or rtftext then you can provide your own behavior for table columns.

Option 1: Set the dgProp["default column behavior"] Property

The simplest way to change the default behavior of table columns is to set the dgProp["default column behavior"] property of the data grid. You set this property to a button id whose script contains the behavior you would like the columns to have. Doing this overrides the default behavior provided by a button on the revDataGridLibrary stack.

set the dgProp["default column behavior"] of group "DataGrid" to the long id of button "My Custom Column Behavior" of stack "MyStack"

Here is an example of a FillInData command that takes a column value encoded as UTF-8 and sets the unicodetext of the column field.

To see the default column script the data grid uses enter the following in the message box:

edit script of button "Default Column" of stack "revDataGridLibrary"

Option 2: Create a Custom Column Template

Alternatively you can create your own custom column template for a particular column. This allows you complete contorl over the look and feel of the column. See the lesson on creating custom column templates.


Add your comment

E-Mail me when someone replies to this comment