WebListBox swap rows

I would like to swap WebListRow using up/down buttons. I came across the following topic:

Reorder listbox rows without drag / drop - General - Xojo Programming Forum

It states that you can use Cell method to grab entire row/column as String. I looked in the documentation and there’s no Cell method for WebListBox. Actually there doesn’t seem to be a Cell method for DesktopListBox either which I believe the post was about. Have things changed? Can I grab an entire row in WebListBox and swap with another row?

The Cell method changed in API 2 to CellTextAt and you can use AddRowAt to insert a new row

That was what I thought. But I tried the following:

SelRow = MyListBox.CellTextAt(MyListBox.SelectedRowIndex, -1)

This gives an OutOfBoundsException because of column is set to -1. So it looks like the entire row cannot be stored like you could previously using the Cell method?

I looked through the link you provided in your first post and no where do I see where the text of an entire row could be selected. To my knowledge that has never ever been possible. The link you provided uses a For loop to swap rows by looping through all the cells in the two rows.

Please scroll discussion to this part:

The -1, -1 trick is undocumented so not everyone knows about it.
It does not work in Web 2.0

3 Likes

The Cell(-1,-1) for ListBox was documented in the older documentation, but indeed, not a peep in the new one. And this never worked for WebListBox.

Thanks for clarifying - so looks like to swap rows, I’ll have to loop through both rows and columns of WebListBox.