LiveCode LessonsLiveCode LessonsHow to - LiveCode Marketplace ProductsData Grid HelperHow Do My DataGrid Can Support UTF-8 or Unicode By Using DGH?

How Do My DataGrid Can Support UTF-8 or Unicode By Using DGH?

This lesson describes, how to change the Default Column Behavior of a Datagrid, for having it supporting UTF-8 or Unicode

Preparing a Behavior Button

Preparing a Behavior Button

Add a new button in your project. This button will received the behavior script for the header.

Name this button "Column Behavior"

Opening the DGH's Behavior Picker

Opening the DGH's Behavior Picker

Once DGH opened by double-clicking on a DataGrid, go in the "Behaviors / Templates" topic.

Click on the 3 dots button (1), for opening the DGH's Behavior Picker, then click on the "Create" button (2).

Moving the Mouse Pointer Over the New Button

Moving the Mouse Pointer Over the New Button

We can now move the mouse pointer over the new button. DGH's Behavior Picker displays an information window with the steps for choosing this button as a behavior for our datagrid columns. (1)

At any time you can discard the selection by clicking on the Behavior Picker's cancel button. (2)

Selecting the Behavior Button

Selecting the Behavior Button

Just click on the button, for selecting it.

In the Behavior Picker window, the "Cancel" button changes for a "Confirm" label.

Validating the Button Selection

Validating the Button Selection

For confirming the button as a default header behavior, click on the "Confirm" button in the DGH's Behavior Picker.

A reference to the button will be added in the Default Column Behavior property value.

Installing the Column Encoding Behavior Script

Installing the Column Encoding Behavior Script

Our Datagrid is now ready to receive a column behavior script.

Go in the DGH's scripts topic and click on the "Install Script" button of the "Column Encoding Behavior" line.

Opening Columns Builder

Opening Columns Builder

We have now to change the properties of each column which we want in UTF-8 or Unicode.

The DGH's columns builder can help by doing that for us.

Open the DGH's columns topic and click on the Edit button for opening "Columns Builder"

Changing the Text Displayed Parameter for One Column

Changing the Text Displayed Parameter for One Column

In Columns Builder

1. Open the Cell Content topic

2. Select the column you want in UTF-8 or Unicode, by clicking on its header

3. Change the Text Displayed property for UTF-8 (or Unicode)

Changing the Text Edited Parameter for One Column

Changing the Text Edited Parameter for One Column

Change the Text Displayed property for UTF-8 (or Unicode)

Note, both Text Displayed and Text Edited are not natives properties of the DataGrid API. These properties are managed by DGH only. However, you can still change them by code, even if DGH is not opened.

Applying the Changes To The Selected Datagrid

Applying the Changes To The Selected Datagrid

Apply the changes to the selected Datagrid by clicking on the "Apply" button

Testing The Result

Testing The Result

1. We can now test the result of our efforts by inputing some UT-8 chars in the second column.

2. As you can see in this example, we will have to apply the same recipe to column 3 (and every column we want in UTF-8) for having the columns managing UTF-8

0 Comments

Add your comment

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