To refer to the controls on a tab page, you need the user object reference, not just the index of the tab page. You can use the tab page’s Control property array to get references to all your tab pages.
The Control property of the Tab control is an array with a reference to each tab page defined in the painter and each tab page added in a script. The index values that are passed to events match the array elements of the Control property.
You can get an object reference for the selected tab using the SelectedTab property:
userobject luo_tabpage
luo_tabpage = tab_1.Control[tab_1.SelectedTab]
In an event for the Tab control, like SelectionChanged, you can use the index value passed to the event to get a reference from the Control property array:
userobject tabpage_generic
tabpage_generic = This.Control[newindex]
When you call OpenTab, the control property array grows by one element. The new element is a reference to the newly opened tab page. For example, the following statement adds a new tab in the second position in the Tab control:
tab_1.OpenTab(uo_newtab, 2)
The second element in the control array for tab_1 now refers to uo_newtab, and the index into the control array for all subsequent tab pages becomes one greater.
When you call CloseTab, the size of the array is reduced by one and the reference to the user object or page is destroyed. If the closed tab was not the last element in the array, the index for all subsequent tab pages is reduced by one.
The MoveTab function changes the order of the pages in a Tab control and also reorders the elements in the control array to match the new tab order.