Number of columns of a Listbox ?

I discovers a strange behavior in my project:

the displayed number of columns in the Listbox is fewer than it appears.

This bother me since… ages, but I do not always saw it, and so it is just now that I really can say there is a bug.

A bug ? Yes, but how can that be ?

And, better, how can I know were (more or less) I see a bug ?

In fact, I just issued a cmd-a followed by a cmd-c, a click in the main window and a cmd-v: I get all my columns I do not saw in the original window *.

I cannot be angry because I wanted to reformat the whole decoding code / window design because of that. Fortunately, I discovers this special feature some minutes ago.

Now, I am asking myself what the bug can be. A REAL bug in Xojo ? I cannot believe that since the Listbox control is so widely used. A bug in my code ? Why not (probably), but how can this be ?

Even when I enlarged (zoom) the window, I only get the same number of columns. BTW: I do not told you that I have the last, rightmost Columns. The missing Columns are before the last one.

Is it possible that those columns have 0 as Column width ? No (after making some tests): I have the item size and item extension column headers, but they are empty. I am totally out of ideas. I will get an eye on the code used to parse the item names, etc. but I cannot believe what I wrote above; still, I will check just in case.

The code seems to be OK. I added the loop below to be sure about the columns widths (I set them to 50 pixels):

[code] Dim Loop_Idx As Integer

For Loop_Idx = 0 To LB.ColumnCount
LB.Column(Loop_Idx).widthExpression = “50”

If UserCancelled Then Exit


Just in case: there are only 10 (or 11 ? I am unsure) columns (10 defined headings plus one empty column with a vertical separator without a Heading string and a large white on the right of the Listbox (well know bug). Even when I resize the window, the contents of two empty Columns is not displayed, but present.

The “missing” contents columns are updated when I set all columns to max width…

Did I told you that this behavior is also present under Windows 10 (in a real PC, current with this week updates).

I also forgot to give the tests conditions:
El Capitan .6,
Xojo 2015r1,
MacBook Pro was shutdown, then after some minutes, a boot.
Internet was OFF.
No other open Application.

A nap is welcome -{

Idea(s) ?

  • In that window, I take a folder (directory) as a source, take all items found there, decode the items names and place them into the Listbox columns. I also take the file extension, file size and some more stuff.
 For Loop_Idx = 0 To LB.ColumnCount -1
    LB.Column(Loop_Idx).widthExpression = "50"
    If UserCancelled Then Exit

columncount is ZERO based like most indexes

Thanks Dave.

After the nap, I had the crazy idea to replace the code above to these two lines:

// Set the Window’s Left and Width values Self.Left = 0 Self.Width = Screen(0).Width

This makes the window to display correctly the Listbox contents. Why ?

Potential bug: if the window is on a different screen (than 0)…