I have a mainform with a tabpanel.
The first tab is selected.
This is the code that works:
var _tabindex = elements.maintabs.tabIndex
if(_tabindex ==1){ elements.tab1.bgcolor = ‘#FFFFFF’ }
if(_tabindex ==2){ elements.tab2.bgcolor = ‘#FFFFFF’ }
But I want to do something like this, but it does not work.
var _tabindex = elements.maintabs.tabindex
var _tabname = elements.maintabs.getTabFormNameAt[_tabindex]
elements[_tabname].bgcolor = ‘#FFFFFF’
If I put the recordindexnumber (and not the var _tabindex) in getTabFormNameAt, it will run, but
than I have to make if or case statements also, I guess this is the only way.
getTabFormNameAt is a function so, should be: var _tabname = elements.maintabs.getTabFormNameAt(_tabindex); also this will be the name of the form on the tab , to get the tab name use: getTabNameAt
Thanks sofar Ivostinar.
So you mean this should work:
var _tabindex = elements.maintabs.tabIndex
var _tabname = elements.maintabs.getTabNameAt(_tabindex)
elements[_tabname].bgcolor = ‘#FFFFFF’
it returns an error: cannot set property “bgcolor” of undefined…
I checked and _tabindex returns a number (‘1’ or ‘2’, since I have two tabs).
this: var _tabname = elements.maintabs.getTabNameAt(1) also returns nothing, I expected to see ‘tab1’
evenso: var _tabname = elements.maintabs.getTabNameAt(_tabindex)
elements.tab1.bgcolor = ‘#FFFFFF’ , sets the first tabcolor to white.
I now see what I am doing wrong.
I use custom tabs.
The tabs in my tabpanel have no name property.
Since my custom tabs are named tab1, tab2 etc. I think I
can use the tab index to set the colors of the custom tabs with a loop.
Thank you both for your time.