Wen 2 WebListbox Cell wrap text?

Does anyone know how to make a Web 2 WebListbox wrap the cell text contents when the cell width is too small for a long text string? This used to just happen in Web 1 so I’m assuming it must be a style setting I haven’t found yet , (hopefully it isn’t a bug/not yet implemented feature)

You will need to use a WebListBoxStyleRenderer,

Public Function StyleWrapWhite(s as string) As WebListBoxStyleRenderer
var style as New WebStyle
style.value(“white-space”) = “normal”
style.value(“word-wrap”) = “break-word”
style.BackgroundColor = color.White
var cellrenderer as New WebListBoxStyleRenderer(style,s)
return cellrenderer
End Function

3 Likes

Hi Gary,

This looks simple enough and the kind of thing I was looking for, but I’m getting compile errors on the Webpage.StyleWrapWhite method.

Public Function StyleWrapWhite(celltext As String) As WebListBoxStyleRenderer
  Var style as New WebStyle
  style.value(“white-space”) = “normal”
  style.value(“word-wrap”) = “break-word”
  style.BackgroundColor = color.White
  Var cellrenderer as New WebListBoxStyleRenderer(style,celltext)
  Return cellrenderer
End Function

WebPage1.StyleWrapWhite, line 2
This item does not exist
style.value(“white-space”) = “normal”

WebPage1.StyleWrapWhite, line 2
There is more than one method with this name but this does not match any of the available signatures.
style.value(“white-space”) = “normal”

WebPage1.StyleWrapWhite, line 3
This item does not exist
style.value(“word-wrap”) = “break-word”

WebPage1.StyleWrapWhite, line 3
There is more than one method with this name but this does not match any of the available signatures.
style.value(“word-wrap”) = “break-word”

BackgroundColor is a property of style so it works, but how did you create the properties white-space and word-wrap?

Never mind. The quote marks were the wrong type in the code I copied from your post and I didn’t notice that at first. With the right quote marks this code works:

Public Function StyleWrapWhite(celltext As String) As WebListBoxStyleRenderer
  Var style as New WebStyle
  style.value("white-space") = "normal"
  style.value("word-wrap") = "break-word"
  style.BackgroundColor = Color.White
  Var cellrenderer as New WebListBoxStyleRenderer(style,celltext)
  Return cellrenderer
End Function
1 Like