Tab Panel Index Issue

I have a tab panel.

It has a property, selectedPanelIndex. Goes from 0 to …
Controls have a property, panelIndex. Docs say it goes from 0 to … to indicate which panel the control is on (-1 if not on a panel).

Problem. It appears the panelIndex starts at 1.

This would appear to be a bug in Xojo as Xojo is pretty much zero-based these days.

DesktopTabPanel (API2) indexes run from 0 upwards. TabPanel (API1) indexes run from 1. They’re two different controls.

Just checked. The panel thing I’m using is a DesktopTabPanel.

It’s acting properly. It’s the controls on the panels that are confused.

Are the controls of the new Desktop variety?

Hi Greg.

Yes. Just checked. The controls in question are DesktopContainters (actually a subclass).

I was checking the panelIndex of the DesktopContainer. It showed 1 on panel 0.
Just added a check for a label in the container. It correctly shows 0 on panel 0.

I’ve not tried that combination, sounds like a bug, worth reporting if you can create a small example to demonstrate the issue.

Will do.

Make sure panel 0 is showing in the IDE when you build the project.

Seems to be as you describe. It only seems to be DesktopCotainer controls that are out by 1. They report 0 if not on a tab panel and 1+ when on a DesktopTabPanel.

@Wayne_Golding TabPanelIndex doesn’t show in the IDE.

@Ian_Kennedy I have found in the past that the default panel will be the one selected in the IDE when the app is built i.e. it doesn’t default to the panel with index 0 hence my suggestion to ensure that panel with index 0 is the one shown in the IDE.

It was indeed the first panel. The debugger shows some interesting issues, If you open the window object and open controls there are two separate versions of the container control on the window. Once is called Container11 (the first instance of container called Container1, the default names provided by the IDE). There is however, a second item called Window1.Container11$0. If you look at Container11 it has the wrong PanelIndex, ie 1. If you look at Window1.Container11$0 it has the correct PanelIndex, ie. 0. Self.PanelIndex returns 1.

The two containers:

Container11, PanelIndex 1:

Window1.Container11$0, PanelIndex 0:

Yeah, those things whose names start with an underscore are not supposed to be visible to end users.

Worse than that they seem to be burning PanelIndex numbers. At least they vary depending upon if you look at Container… or _Window.

@Bob_Gordon Did you make a report yet. If not I’m happy to do it, I have a demo project that shows the issue.


Made report. Actually got a question about it this morning, which is encouraging,

What’s the number?


Thanks, I will thumbs up. You can thumbs up your own reports.