panelindex, tabpanelindex, ?

just came into this mess, as some refresh did not work properly…

in the documentation, it is said to use panelindex as tabpanelindex is deprecated.
I found that a containercontrol has a tabpanelindex property, but no panelindex ?
that the pagepanel.value property is zero-based
that panelindex is zero-based
but that tabpanelindex is 1-based (and in the doc described as zero-based)

what is true ?

While myContainerCtrl.tabpanelindex does autocomplete, if you look in the docs there is no panelIndex nor tabpanelindex of a container control. A pagepanel or a tab panel has a panelIndex property and that’s what you should be using.

my search at documentation.xojo.com produced no results for “tabpanelindex”

the idea is to detect if a containercontrol is on a visible page of a pagepanel or tabpanel to refresf it’s content or not, as it is a list of remote records of a database, so it is a time consuming task.
so I must use tabpanelindex for the containercontrol, and compare it to the pagepanel.value.

I’ve never heard of TabPanelIndex. Are you confusing it with TabIndex?

IIUC, your best bet is to add a whichPanel property to your CC and keep track of which tab it resides on that way.

I just did a search for TabPanelIndex in a project open in Xojo 2015
Turned up 615 instances, all properties of buttons, canvases etc

Im sure I have used it before when putting controls on tabpanels.
The tabpanel is the parent, but you might still want to know which actual panel governs the visibility.

[quote=354983:@Jean-Yves Pochez]just came into this mess, as some refresh did not work properly…

in the documentation, it is said to use panelindex as tabpanelindex is deprecated.
I found that a containercontrol has a tabpanelindex property, but no panelindex ?
that the pagepanel.value property is zero-based
that panelindex is zero-based
but that tabpanelindex is 1-based (and in the doc described as zero-based)

what is true ?[/quote]

TabPanelIndex is deprecated, but it still works
PanelIndex is the new TabPanelIndex
TabPanelIndex is 1-based
PanelIndex is 0-based
Some times they don’t auto-complete, but still work… I would recommend to use PanelIndex as it is 0-based, just like .Value is (I use it in my code so I don’t have to keep track of the panel index manually)

if you use containercontrols, there is no panelindex, but still the tabpanelindex, and it is 1-based.
it’s not documented, but it autocompletes, and you can look at it in the debugger.
just be aware of that…

ContainerControl is a subclass of Window, not of Control. At runtime it “poses” as an EmbeddedWindowControl which is a subclass of Canvas, which is a subclass of Control, so EmbeddedWindowControl has a PanelIndex property.

Yeah, PanelIndex exists for ContainerControls, I checked before my post

ContainerControl has no property PanelIndex. This does not compile:

// In a method or event of a window: If ContainerControl11.PanelIndex = -1 Then // ... End
Error: Type “ContainerControl1.ContainerControl1” has no member named “PanelIndex”.

weird… I did a test project and PanelIndex worked, but I just remade the sample and it throws the error… I only have one version of Xojo installed (2017r2.1) so no idea what happened…

I see what I did… I used me.PanelIndex in my button… Was pretty sure I used self, but I do make mistakes too :slight_smile: