I did the same as you are trying to do when navigating to layouts. For mine I named all the segments the same as the first part of the layout name (ie. Builder Details or Builder List). For my calculation I used...
~Layout = LeftWords ( Get ( LayoutName ) ; 1 ) ;
~Layout = "Company" ; ~Layout ;
~Layout = "Subdivision" ; ~Layout ;
~Layout = "Builder" ; ~Layout
Thank you, but how does that change the color to black when on that layout?
You have to choose which button in the bar is "Active" for each layout. If you have 3 layouts: Layout 1, Layout 2, Layout 3, and you're on layout 3, you want that button to be active. Click on the "Layout 3" button and in the button bar set up, choose that as the active button.
That will use the Active state of the buttons in the bar, which is found in the inspector.
You could easily do the calculation, which is more modular. If you NAME each button segment as its corresponding layout name, and use the calc dialog in the Choose-Active segment, you can dynamically choose which is active through this calc.
The calculation matches the layout name and the button name and then applies the active segment formatting. I put an example file on dropbox that you can check out.
In Appearances I've made the fill color of a button bar for 'inactive' blue. All other states, hover, pressed, and in focus are made black. The goal is once a button is pressed it stays black.
I noticed in your initial post you did not mention the active state. Make sure you set "Active" to black as well.
Thanks for your example Paul. That makes it very clear. Much appreciated.