2 Replies Latest reply on Apr 15, 2015 9:41 AM by philmodjunk

    Set Theme by Variable to Identify FM File.



      Set Theme by Variable to Identify FM File.



      FMP13 Here.

      Is it possible to set a theme by Variable? 

      I'm trying to create a duplicate of my database to use for training (a simple copy of all records/layouts etc) that I want to identify with a different background based on which file you are in. 

      The logic I'm trying to use is: 

      1. Set $$Mode="Training" / or Set$$Mode="Live"
      2. IF $$Mode="Training" THEN Theme=Training (which would be a watermark-like background on all Layouts)
      3. IF $$Mode="Live" THEN (the theme would be whatever the theme is for the particular layout)

      What I like about this idea is that there's only 3 quick steps to refresh the training environment:
      1. Create a Duplicate Copy of the current live db (so everything new and updated I have created is here)
      2. Rename Duplicate Copy to "Training Mode" 
      3. Change $$Mode to Training

      It seems like setting the theme by variable would accomplish this, but I am open to other ideas. 


        • 1. Re: Set Theme by Variable to Identify FM File.

          A very interesting idea.  I would love to see how this is resolved.

          • 2. Re: Set Theme by Variable to Identify FM File.

            A script cannot change the theme specified for a layout. This is something that can only be specified manually while in layout mode.

            But there are ways to dynamically change the background color of a layout. It is also possible to use duplicate layout to make a copy of the layout where you then specify a different theme for the copy. A script can then select one layout or the other.

            One way to change the background color dynamically is to place a conditionally formatted "do nothing" button or an empty field or a layout text object on your layout, behind all other objects and sized to fill the body layout part. The conditional format expression can then dynamically control the fill color of this layout.

            An "old school" method that we used to use was to cover the layout background with a container field into which we had inserted a solid color rectangle with the "enlarge or reduce contents" options specified and the "maintain proportions" check box cleared. By putting different rectangles in the field we got different color backgrounds. This was the precursor to conditional formatting. (This container field was actually a calculation field with "container" specified as the result type. The calculation selected the contents of one of several global container fields that each stored a different color rectangle object.)