WebListBox.CellTypes.TextField with WebListBoxStyleRenderer

Looks like the combination of WebListBoxCellTypes.TextField with WebListBoxStyleRenderer makes the edited text the text version of the renderer (as below)

Xojo-Style|XOJO|{"font-family":"Helvetica","font-size":"9.0px","border-width":"2px","border-style":"solid","background-color":"{\"light\":\"rgba(255,255,255,1.00)\",\"dark\":\"rgba(255,255,255,1.00)\"}","color":"{\"light\":\"rgba(0,0,255,1.00)\",\"dark\":\"rgba(0,0,255,1.00)\"}","_xojo_type":"Xojo-Style","xojo_target":"cell","xojo_value":"test"}

Is there a way around this?
I think it’s great to be able to do inline editing of cells, but without the ability to format it, I envision a gap to clean implementation.

But, as is frequently the case, I am probably missing something.

If you share a sample, someone can review and see if something can be done.

2 Likes

Sure thing.

Start a new web project. Drop a listbox in, and in the shown event put this code:

Me.addrow ""
Me.CellTypeAt(0,0) = WebListBox.CellTypes.TextField

Var style As New WebStyle
style.BackgroundColor=Color.RGB(220,220,0)
style.FontName = "Helvetica"
style.FontSize= 12
style.Bold = True
style.ForegroundColor= Color.DarkGray

Me.CellRendererAt(0,0) = New WebListBoxStyleRenderer(style, "Example text")

Then try to edit the cell.
It reveals the following as the editable text and when you leave the cell that is what stays.

Xojo-Style|XOJO|{"background-color":"{\"light\":\"rgba(220,220,0,1.00)\",\"dark\":\"rgba(220,220,0,1.00)\"}","font-family":"Helvetica","font-size":"12.0px","font-weight":"bold","color":"{\"light\":\"rgba(85,85,85,1.00)\",\"dark\":\"rgba(85,85,85,1.00)\"}","_xojo_type":"Xojo-Style","xojo_target":"cell","xojo_value":"Example text"}

Actually, and after you edit, the renderer seems to be gone or ineffective.
I think this is a bug and will post it unless someone can tell me how I’m seeing it wrong.

I’m going to see if there is a work around, maybe by holding the editable content in the cell tag and setting the text to that value when the edit starts, and restoring the editor when done - but that shouldn’t be what’s needed.

Regardless. I like the direction the WebListBox is going.

Sample code:
ChrisStyleRenderer.xojo_binary_project.zip (8.3 KB)

Screenshots:

@Ricardo_Cruz does this help?
@Chris_Halford maybe you want to open an Issue?

1 Like

Thanks for the sample project @AlbertoD, I’ve just created the Issue:
Issue #78848

1 Like

A fix for this will be included in 2025r1.1.

4 Likes

That’s great. Thanks.
This will be really helpful for a project I’m about to start.

1 Like