WebListBox.ColumnWidths

@AlbertoD @Jose_Fernandez_del_Valle

Here is a visual summary capturing some (but not all) of the issues you maybe experiencing. It might assist your feedback case.

Kind regards, Andrew

While this controls shouldn’t appear, the listbox always uses RowSets behind the scenes because we create an in-memory sqlite database to manage the data.

Thank you for clarifying that point @Greg_O_Lone. At what point, should those controls appear (greater than 25 rows if adding rows with AddRow)?

They shouldn’t appear at all in the config we are using because they cause issues with positioning and we aren’t using pagination.

1 Like

Thanks, Andrew.

That is what happens to me, I fixed it by adding the code where it works.

In your example, ColumnWidths is always ignored. On my end, one ColumnWidth works and the other does not.

Thanks to you, I am a step closer to migrating from XOJO 2019 to XOJO 2020.

1 Like

I’m running Xojo 2020R2, and the following code in Opening or Shown of a WebListBox does not change the column widths:

Me.ColumnCount = 5
Me.ColumnWidths = “100, 200, 50, 100, *”

If I run the code in the Shown event, I get the “Show X entries” and “Previous / Next” buttons as shown in Andrew’s post.

Is there a workaround as I need to set the number of columns and their widths dynamically?

1 Like

Try this code:

In WebListBox SHOWN event:
Me.ColumnWidths = “100, 200, 50, 100, 20”

In WebListBox OPENING event:
Me.ColumnSortTypeAt(0) = WebListBox.SortTypes.Unsortable
Me.HeaderAt(0) = “Any Name”

Tell me if it worked for you.
In my experience, only dynamic change works on a SHOWN event.

No, that didn’t work.

Did you actually got this to work so you could set the column widths?

Not really. Try to add only one character (at least less than your column is defining), then it will work, but if you are adding then more text it might very well overrule your settings. In other words: it works for me for columns with a fixed number of characters (dates etc), but if I can’t predict the length of the content, I usually run into trouble. Can you confirm this by trying it yourself?

Here is my summary of issues with the WebListBox 2.0:

  1. You cannot Select Rows in code (<https://xojo.com/issue/60041>)
  2. ColumnWidths cannot exceed 100% (<https://xojo.com/issue/61610>)
  3. ColumnCount cannot be changed in Code (<https://xojo.com/issue/61631>)
  4. WebListBox doesn’t centre on the WebPage like other objects (<https://xojo.com/issue/61837>)
  5. You cannot force a WebListBox to hold all the data (<https://xojo.com/issue/61765>)
  6. You cannot Add Rows, Remove Rows in one Method, then use RowCount as it will be inaccurate (<https://xojo.com/issue/62633>)
  7. If you double-click a selected Row, no Row is selected in the DoublePressed Event (<https://xojo.com/issue/62779>)
  8. WebListbox on a WebContainer on a WebTabPanel shows Rows differently (<https://xojo.com/issue/62823>)
  9. Unlike Desktop, WebListBox has no LastRowIndex (<https://xojo.com/issue/62749>)
  10. WebListBoxes don’t draw when moving amongst WebPagePanels (<https://xojo.com/issue/62821>)
  11. WebListBox Heading text wrapping causes WebListBox to become taller (<https://xojo.com/issue/62827>)
  12. WebListbox.CellAt doesn’t function after WebListBox has been sorted (<https://xojo.com/issue/62772>)
5 Likes

Plus, the text within WebListBox cells do not wrap — the WebListBox shrinks until the text fits on one line, then will shrink no more.

Thank you David, even though it’s i bit depressing.

Issue 1, 2 and 3 in your list prevent me from upgrading my apps to web 2.0.

With your list I know which issues I should wait for.

You can make a cell wrap by using a WebListBoxStyleRenderer.

1 Like

Gary, can you elaborate?
I cannot see anything in WebStyles (https://documentation.xojo.com/api/user_interface/web/webstyle.html) to do with Cell Wrapping, nor in the CSS guide (Animatable CSS properties - CSS: Cascading Style Sheets | MDN), nor in the Xojo LR.

Don’t worry Gary, I worked it out from here Web2 : enable multiline word-wrapping. Thank you.

1 Like

I also include this line. style.value(“word-wrap”) = “break-word”
I don’t remember why, but it fixed some issue that I was having with the wrapping.
Thanks

2 Likes

I’ll try that too, thank you!

You might want to try skipping the padding line as well, or playing around with it in a deeper granularity. Padding alone will change the padding of all 4 directions (top, bottom, left, right ). You probably don’t want to change the “padding-left” to 0 or 1 everywhere.

This article might help you as well:

1 Like

You can add this to the list: Unable to set weblistbox.columnwidths in code (https://xojo.com/issue/62938)

1 Like

Wow, you are right!

I just assumed it was working at 100%. I have added an updated Sample project to #2 (<https://xojo.com/issue/61610>) with a new Random button, where the column widths are adjusted randomly to widths <= 100%, and there there is zero effect on the displayed column widths.

2 Likes