getTabFormNameAt question

Questions, tips and tricks and techniques for scripting in Servoy

getTabFormNameAt question

Postby Ron » Wed Aug 05, 2009 6:49 pm

Hi all,

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.

Thx.
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Re: getTabFormNameAt question

Postby lvostinar » Thu Aug 06, 2009 10:28 am

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
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: getTabFormNameAt question

Postby Ron » Thu Aug 06, 2009 12:32 pm

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.

Ron
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Re: getTabFormNameAt question

Postby sanneke » Thu Aug 06, 2009 1:12 pm

Hi Ron,

I think what you are looking for is this:

elements.maintabs.setTabBGColorAt(_tabIndex, '#FFFFFF' )
Sanneke
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
sanneke
 
Posts: 383
Joined: Thu Jun 15, 2006 9:20 am
Location: Amersfoort

Re: getTabFormNameAt question

Postby Ron » Thu Aug 06, 2009 3:15 pm

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.

Ron
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 46 guests

cron