Therese Posted March 17, 2008 Share Posted March 17, 2008 Here's what I am sure the gurus will quickly find an answer to. I have a field LayoutNames (Get ( FileName ) ) giving me a tidy list of all my layouts. Positioned over the top are buttons to take my user to each layout at a click. I would like the current layout name (on the page they are viewing ) to display in red/bold (within the list) so the user can see quickly where they are. I am sure its propably using the functions TextStyleAdd or RGB, but a little brain dead how to apply it. Your help is appreciated Quote Link to comment Share on other sites More sharing options...
Weetbicks Posted March 18, 2008 Share Posted March 18, 2008 I'd make a slight modification to your method to make this a simple implementation. Change your calc to list layout names into a repeating field with X number of repetitions (however many layouts you have). Make it a calculation, and the calc will be: Let ([ LayoutNames = LayoutNames ( Get ( FileName ) ) ; CurrentLayout = GetValue ( LayoutNames ; Get ( CalculationRepetitionNumber ) ]; if ( Get ( LayoutName ) = CurrentLayout ; TextStyleAdd ( TextColor ( CurrentLayout ; RGB ( 221 ; 0 ; 0 ) ) ; Bold ) ; CurrentLayout ) ) The calc is evaluated different for each repetition. The 10th repeition contains the 10th layout name, the 11th contains the 11th and so on. The final step is it checks if its contents (a layout name) is equal to the current layout name, if it is, iti shows it in red and bold, otherwise it just shows it). Give this a crack and see how it goes. I think its nicer than a single field with buttons overlaid, you'll still need overlaid buttons, but they can be the same width/height of each repetition, and you can select the whole thing and resize it all in one go. ================ If you are intent on using a single field, change the calc to this: Let ( [ LayoutNames = "¶" & LayoutNames ( Get ( FileName ) ) & "¶" ; Layout = Get ( CurrentLayout ) ; FormattedLayoutNames = Substitute ( LayoutNames ; "¶" & Layout & "¶" ; TextStyleAdd ( TextColor ( "¶" & Layout & "¶" ; RGB ( 221 ; 0 ; 0 ) ) ; Bold ) ) ]; RightValues ( FormattedLayoutNames ; ValueCount ( FormattedLayoutNames ) - 1 ) ) I havent tested this, just written the code out now, so it may or may not work pasted verbatim, but hopefully you get the idea of what its trying to do. We wrap the layout names in return delimiers so we can isolate a full layout name to make it red/bold. All values in the list (layout names) that match current layout name are substituted for itself but in red and bold. Its wrapped in return delimiters to resolve the following issue: Layout 1 Layout 2 Layout Layout 3 Layout 4 If we were on the layout name "Layout" we only want the 3rd value to be red and bold, not every single one (cos they all contain the layout name). Quote Link to comment Share on other sites More sharing options...
Therese Posted March 18, 2008 Author Share Posted March 18, 2008 Thankyou. I'll give it a burl and report back. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.