Page 1 of 1

Format selected tab text?

PostPosted: Sat Feb 02, 2008 10:28 pm
by macfreq
I looked at the SeedCode_Tabs_1Names custom function and I think this is the place to start to solve this question. I want the text to change to red when I select a tab, or a sub-tab.
I tried to make a couple changes but I didn't get the result I wanted. Is this the place to start, or should I bark up another tree.

I made the following changes to the case statement but the text only changes to red when the tabs line up.

Case (

Rep ≤ 199 ;

// ------------------------------ Repetition 1 - 199 represent the top level (level 1) tabs.

TextColor (
SeedCode_GetValueStrict ( MiddleValues ( $$Level1TabSetContents ; Rep ; 1 ) ; "TabName" ) ;
If ( $$ActiveTabNumber = Rep ; RGB(255;0;0) ; "" ) ) ;

Rep ≤ 299 ;

// ------------------------------ Repetition 201 - 299 represent the second level (level 2) tabs.

TextColor (
SeedCode_GetValueStrict ( MiddleValues ( $$Level2TabSetContents ; Rep - 200 ; 1 ) ; "TabName" ) ;
If ( $$ActiveTabNumber = Rep -200 ; RGB(255;0;0) ; "" ) ) ;

Rep ≤ 399 ;

// ------------------------------ Repetition 301 - 399 represent the lowest level (level 3) tabs.

TextColor (
SeedCode_GetValueStrict ( MiddleValues ( $$Level3TabSetContents ; Rep - 300 ; 1 ) ; "TabName" );
If ( $$ActiveTabNumber = Rep - 300; RGB(255;0;0) ; "" ) ) ;


When I select the Week view in Calendar, I'd like Week and Calendar to be red. With the changes I did above, Projects and Week are red.

Hope that makes sense.

Thanks for the help.

PostPosted: Sun Feb 03, 2008 7:29 am
by John Sindelar
Nice work. I think you're just missing one item in these calcs. Try this:

Instead of...

If ( $$ActiveTabNumber = Rep ;

use...

If ( $$ActiveTabNumber = Rep and IsEmpty ( $$Level2TabSetContents ) ;

...and then for the second set...

If ( $$ActiveTabNumber = Rep - 200 and IsEmpty ( $$Level3TabSetContents ) ;

... the third set just becomes:

If ( $$ActiveTabNumber = Rep- 300 ;

PostPosted: Wed Feb 06, 2008 9:22 pm
by macfreq
This change works great. It would look better if the text color would be changed to red for the active tab text for each of the levels. For example, Calendar and Week text would be red when the Week layout is active.
I think this case statement only applies to one active tab at a time. Can it be extended to do this to the third level, or would it need to be changed to If statements.

Thanks.

PostPosted: Thu Feb 07, 2008 7:59 am
by John Sindelar
We can change it so that the selected tab of each level is red, not just the active tab. We'll add an OR condition to the If statements we're using now.

Instead of testing like this:

If ( $$ActiveTabNumber = Rep and IsEmpty ( $$Level2TabSetContents ) ;

...use...

If ( $$ActiveTabNumber = Rep and IsEmpty ( $$Level2TabSetContents ) or $$Level2TabSetID = SeedCode_GetValueStrict ( MiddleValues ( $$Level1TabSetContents ; Rep ; 1 ) ; "TabID" ) ;

...and then for the second set...

If ( $$ActiveTabNumber = Rep - 200 and IsEmpty ( $$Level3TabSetContents ) or $$Level3TabSetID = SeedCode_GetValueStrict ( MiddleValues ( $$Level2TabSetContents ; Rep - 200 ; 1 ) ; "TabID" ) ;

... the third set just remains:

If ( $$ActiveTabNumber = Rep- 300 ;

PostPosted: Thu Feb 07, 2008 9:53 am
by macfreq
That's perfect. I was wondering how to do the OR in the case statement.

Thanks again.