LiveCode LessonsData GridLiveCode Data Grid Using The Built-In Field EditorHow Can I Edit The Text as UTF-8, UTF-16 or HTML?

How Can I Edit The Text as UTF-8, UTF-16 or HTML?

The default Data Grid behavior when editing cell contents is to use the text property of the cell as the default value to be edited. This lesson will show you how to provide a specific value for the Data Grid to use as the value to edit.

The technique described requires that you create a custom column behavior as outlined in this lesson.

The Default Behavior

The Default Behavior

Assume you have a column in your table that displays text with some styling. In this example the name in column 1 is bold.

When you edit the content of the cell the formatting is lost however. This is because the Data Grid edits the text property of the field by default.

Changing the Default Value For the Editor

Changing the Default Value For the Editor

You can change the default value of that the field editor uses by setting a value of the dgTemplateFieldEditor property of the Data Grid. You set the property before calling EditFieldText.

For example, if you wanted to display the bold text for editing you could set the dgTemplateFieldEditor["htmltext"] property to the htmltext of the column being edited:

set the dgTemplateFieldEditor["htmltext"] of the dgControl of me to the htmltext of me

Other properties you can set include "rtftext", "text", "unicodetext" and "utf8text".

The Result

The Result

Here is the result of using the example code above in the custom column behavior. Notice how the text being edited is bold.


Add your comment

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