1) You can give each tab panel an object name using the name box on the inspector's position tab. The OnTabSwitch script trigger can perform a script that uses the get function for the target tab panel to set a global field or variable to this object name. Then the OnRecordLoad trigger you can set for the layout can perform a script that uses go to object to put the focus on the correct tab panel (bringing it to the front) when you change records.
2) In the appearance tab, check and see what state was selected when you selected the fill color. You can select different fill colors for Hover, normal, pressed and in focus states. It sounds like you didn't select the color for the Normal state if you only see the color when you select the tab--which would be the in focus state. There's a drop down for specifying the state.
Odd, I don't see my post here. So, followup. Since my existing script OnRecordLoad was doing a Goto Object and setting something, every time I moved between records, even when on a different tab, I would end up on the Main tab. What I did was 2 things. I added an "On Object Modify" trigger to the tabs, after naming the tabs. (Side note: I really would have thought it should be the On Object Enter, but that didn't work. OOM actually triggers when switching tabs). Then in my script, I added an If statement to check if I was on the main tab, and only then, perform the script as before. I did have to add the OOM for the tab (uses same script), because the record only is "Loaded" once and if I move between records in a different tab, then move the main tab, it didn't perform the script from the ORLoad.
It's working like a charm.
Thanks Again (why my last thanks didn't show up is odd).
Please take a look at the trigger "OnTabSwitch". It's a new trigger added with the release of FileMaker 12 and the new get functions that can be used with this to identify the tab panel that is now the front tab panel.
This method results in a much simpler script.
With older versions, you have to use GetLayoutObjectAttribute to test each tab panel to detect which one is now in front, but with FileMaker 12 and newer, you can use a single get function call to get the object name of the front tab panel instead.
Thanks Phil. I can't find an "On Tab Switch", but I see "On Panel Switch" which must be the same thing. I'll give it a look and report back if it makes things cleaner.
Yes, that's the one. They renamed the trigger in FMP 13 on me.