ListBox in Container Anomaly

I’ve been trying to get my app better organized using Container Controls.
Ran into a little problem so I created an example trying to isolate the issue.

I have this listbox. In the Open Event I have this code. Works fine, populating the headers.

Me.HasHeading=True Me.ColumnsResizable = True Me.textsize =12 Me.ColumnCount =10 Me.ColumnWidths="10%,10%,10%,10%,10%,10%,10%,10%,10%,10%" Me.Heading(0)="One" Me.Heading(1)="Two" Me.Heading(2)="Three" Me.Heading(3)="Four" Me.Heading(4)="Five" Me.Heading(5)="Six" Me.Heading(6)="Seven" Me.Heading(7)="Eight" Me.Heading(8)="Nine" Me.Heading(9)="Ten" Beep

Then I create a Container Control. Cut the Listbox out of the main Window and paste it into the Container control. Looks good. The Open Event code (above) was copied as expected. Then place the Container, (with the listbox) onto the Main Window. But now when I run the app, the headers don’t show up. I believe the app is executing the Open Event because I hear the beep at the end. But no headers. Any idea why this is not working?

I tried putting the above header code in the Open Event of the Container, (with full references instead of using me prefix) but that didn’t work either. I even place the code in a button. Still, the beep goes off but the header don’t not get populated.

Xojo version?
Mac, Win, Linux?

Using Xojo2018r3 on macOS 10.12.6, small test with that code and it works.

Using Xojo2018r3 on macOS 10.14.2, works here too.

Suggest you delete the listbox and drag a new one to the ContainerControl.

You could also populate the header in the IDE instead of in the open event.

I’m using Xojo2018r4 on Windows 10.

I did try deleting the listbox and replacing it with a new on on the Container Control.

Here’s a link to the sample app where I’ve isolated the problem:

Good idea Markus! I’ll just populate the headings from the IDE Inspector

I tried your test project on Mojave with Xojo 2018r3 & it works. Just guessing but it might be a Xojo bug with the Windows version?

I went ahead and populated the headings from the IDE Inspector. That worked.
But still the CompareRows event for numeric sorting no longer works.
Though… the ListBox.AlignRight in the Open Event did catch.

I installed Xojo2018r3. Had the same problem. Thought the reversion conversion might carry over the problem, so I just created the same sample project from scratch. No change.

I guess I’ll just wait for another Windows user to try it out. Seems everyone is running Macs.

I would say you’ve found a bug. The header is there (taking up space) but isn’t drawn. If you set the inspector property hasheader to on everything else works just fine.

Have you emptied your cache? Sometimes Xojo gets into a weird state …

Thanks everyone for chipping in on this. Something new users should always consider.
This is one of the best things about Xojo! The community!! What a pleasure.
Posting a message and getting answers so quickly.

I will download the Feedback app and post this as a bug. Done.

Less than 24 hours after reporting this bug, I got these messages:

[quote]User “William Yu” has updated case #54689.
»»Status changed from ‘Verified’ to ‘Fixed’.
»»Report closed. This case was not ranked

[quote]The following comments were left:

As a temporary workaround, you can add this bit of code in your ContainerControl Open event
to force the Listbox headers to appear (they are actually hidden which was the bug):[/quote]

Me.Visible = False Me.Visible = True

Good it was an easy fix and there is a workaround.
William is great.