Displaying HTML in DataGrid (table mode) – supported or not?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
guylouis
Posts: 32
Joined: Mon Feb 01, 2016 11:45 pm

Displaying HTML in DataGrid (table mode) – supported or not?

Post by guylouis » Sun Apr 19, 2026 4:56 pm

Hello,
I’m working with a DataGrid in table mode (not form) in LiveCode.
I would like to display formatted text (HTML), for example something like:
<b>Black</b> <font color="red">Red</font> <b>Black</b>
or more concretely (bridge application):
5 ♥ E+2 where only the ♥ symbol is red.
I have tried several approaches:
set the dgText of group "dgTest" to ...
set the dgData of group "dgTest" to ...
using "htmlText" in the array
setting properties like dgProp["htmlText"] or similar
In all cases, the HTML is either displayed as plain text or ignored.
Question:
Is it actually possible to display HTML-formatted text (with partial colors) inside a DataGrid cell in table mode?
If not:
is there a recommended workaround?
or is switching to a form-style DataGrid / custom template the only solution?
Any clarification on what is officially supported would be very helpful.
Thanks in advance!

Emily-Elizabeth
Posts: 195
Joined: Mon Jan 03, 2022 7:10 pm
Contact:

Re: Displaying HTML in DataGrid (table mode) – supported or not?

Post by Emily-Elizabeth » Sun Apr 19, 2026 6:18 pm

Doesn't look like you can't set the htmlText, perhaps it's something that can be added.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10397
Joined: Fri Feb 19, 2010 10:17 am

Re: Displaying HTML in DataGrid (table mode) – supported or not?

Post by richmond62 » Sun Apr 19, 2026 6:54 pm

Doesn't look like you can't set the htmlText, perhaps it's something that can be added.
Looks logically wonky: surely:

"Doesn't look like you can set the htmlText, perhaps it's something that can be added."

bamakojeff
Posts: 37
Joined: Tue Dec 06, 2022 6:53 pm

Re: Displaying HTML in DataGrid (table mode) – supported or not?

Post by bamakojeff » Mon Apr 20, 2026 4:40 am

I do not believe that you can do this in Table mode for a DataGrid. But you can definitely do it in Form mode. Since you put "normal" livecode fields into a form, in your datagrid script to populate the form, you can assign the htmltext of the field just like you can any livecode field.

So if the field in the form was called "bridgeFld", you create an array to hold the data:

Code: Select all

put "5 <font color='#FF0000'>♥</font> E+2" into tDataArray[1]["bid"]
set the dgData of group "myDataGrid" to tDataArray
Then in the script for the datagrid you would write:

Code: Select all

on FillInData pDataArray
   set the htmltext of fld "bridgeFld" of me to pDataArray["bid"]
end FillInData
And your line in the DataGrid would look like
5 E+2
(This assumes that the "foregroundColor" of the field is black. But you could set it to whatever you wanted. Or you could specify all the colors in the HTML text as well if you wished.)

DataGrids are "deep magic" but the basics are not difficult. I've attached a stack which does this if it helps give you ideas.

HTH

Jeff
Attachments
BridgeNotes.livecode.zip
(5.41 KiB) Downloaded 6 times

guylouis
Posts: 32
Joined: Mon Feb 01, 2016 11:45 pm

Re: Displaying HTML in DataGrid (table mode) – supported or not?

Post by guylouis » Mon Apr 20, 2026 11:42 am

Thanks Jeff,
That confirms exactly what I was observing.
I initially tried to do this in table mode, but HTML is clearly not supported there (it is either ignored or displayed as plain text). Your explanation about using form mode with real fields makes things much clearer.
In my case (bridge scoring), I specifically wanted to display things like:
5 ♥ E+2 with only the ♥ in red.
I managed to get an acceptable result in table mode using Unicode symbols, but without partial coloring. So for now I’ll probably keep that approach for performance and simplicity.
However, your example with htmlText in a form DataGrid is very helpful, and I may switch to that if I decide to prioritize richer rendering.
Thanks also for the sample stack — much appreciated!
Best regards

Post Reply