CellValueAt and WebListBoxCellRenderer

I add values to a WebListbox, which are created by WebListBoxCellRenderr to show them in Bold or right aligned, for example. With version 2021r1, I was able to read the contents with CallValueAt . And this was a json, so I was able to read the value.

With 2021r2 this doesn’t work any more. As soon as I try to read the value, I get an exception (TypeMismatch). So I don’t know how to read the values now. I need them for later processing.

To store the unformatted value in a CellTag is no real solution, because I use this today for other values. And there are not enough columns free. And I have to change most parts of my applications again.

Does some know a way to get the values from the list.?

There were a few regressions with WebListbox in 2021r2 which we are trying to resolve.

1 Like

The applications are productive with 2020r1.1 and so I can wait with upgrading.

I have the same problem. How has it been resolved?

Which version are you using?, it seems to be working fine using Xojo 2022r1.1.

If you’re using a WebListBoxStyleRenderer, for example, you can get its value using this code:

Var row As Integer = 0
Var column As Integer = 0
Var myCellRenderer As WebListBoxStyleRenderer = ListBox2.CellTextAt(row, column)
MessageBox(myCellRenderer.Value)
1 Like

It’s working perfectly. I don’t know why when I did this before value option was not available

Please please, add this example in the documentation.

3 Likes

X2 pretty please with a cherry on top

got this error

Type mismatch error.  Expected class WebListBoxStyleRenderer, but got String
dim myCellRenderer As WebListBoxStyleRenderer = me.CellTextAt(me.SelectedRowIndex, 0)

Try this:

dim myCellRenderer As WebListBoxStyleRenderer = me.CellRendererAt(me.SelectedRowIndex, 0)

and how i extract the “value” or text from the cell ?
CellTextAt shows nothing

Can you create a sample project, zip it and upload here?
I guess you are using Xojo2025r1, right?
Your code looks like this?

dim myString as String = me.CellTextAt(0,0)

Edit: there is a change in Xojo2025r1 and what worked with older Xojo for StyleRenderer no longer apply (in some cases at least).

Here is a sample project setting and getting a WebListBoxStyleRenderer:

weblistboxstylerenderer.xojo_binary_project.zip (8.8 KB)

Why complicate thinks like that ? .CellTextAt(x,y) was perfect !

Your previous post you talk about the value/text

What 2025r1 does is separate the text from the style.

Can you share an example?

When you populate a WebListBox with .AddRow("cell1", "cell2")
Or you add text to a cell .CellTextAt(x,y) = "the text"
Everything is fine

But if you want to put some colors, or just add bold text in your cell using style and renderer thing, you can’t retreive any text from the cell, you need to do a funny extraction like Ricardo shows :

dim myCellRenderer As WebListBoxStyleRenderer = me.CellRendererAt(me.SelectedRowIndex, 0)
1 Like

Now I understand.

I expected to use something like:

Var value as String = listbox1.CellTextAt(0,0)

no matter if the cell has a Style or not, instead of:

Var renderer As WebListBoxStyleRenderer = WebListBoxStyleRenderer(ListBox1.CellRendererAt(0, 0))
Var value As String = renderer.Value

In other words, make CellTextAt only retrieve/write the renderer.Value

Not sure if this can be possible for a future version.

it should !

Xojo boasts that it’s easy to program in this language. I waste hours trying to find a solution for a simple function in the documentation that doesn’t even mention this phenomenon.

Someone who doesn’t use the web framework stepped in and ruined things they didn’t understand. This person has a habit of doing that.

It was originally CellValueAt as Variant when Web 2.0 launched, which was incredibly flexible.

1 Like