8 Replies Latest reply on Aug 8, 2012 12:52 PM by raybaudi

    changing field color

    rdoray@charter.net

      Title

      changing field color

      Post

      Hi everyone, 

      I'm very new here to this forum and to FM.  I'm trying to make a field change colors based on 3 values calculated in other field.

       

      It seems I can pass a global or temporary variable from one field to another. For example purposes, Here's what I'm thinking:

      TextColor ( dbasename::fieldname ; RGB ( %%r; %%g; %%b) ) 

       

      what I'd like to do is change the background color of that field instead of the text.  Using transparancy and putting different color boxes is not an option as there may be thousands of different RGB combinations.

       

      conditional formatting i can't see working because the color cannot be pre-defined.

      any thoughts anyone?

      again, I'm very new and trying to learn this to see if it will work for our company.

       

      thanks in advance for any help

      rob

        • 1. Re: changing field color
          philmodjunk

          If you want to dynamically set the r, g and b values for a field's fill color, this cannot be done.

          You can set up a series of conditional value list expressions such as:

          $$color = Red
          $$Color = Orange
          $$Color = Blue

          and so forth, each row here is a different conditional format expression and you can specify a different fill color for each row.

          Then, to change the color, you need only change the value of $$Color. You could also use a global field formatted with a drop down list of color names in place of $$Color.

          • 2. Re: changing field color
            rdoray@charter.net

            Thanks Phil, That seems like it may work based on just a few sets of colors. I currently have over 2000 records in a database  to choose a specific color.  What I would like to have happen is when my customer chooses a single record, the RGB values of that color (all in there own specific fields) within that record will display a color on their screen. The field showing the color would actually have no data associated with it (so maybe a 'container'. Again, i'm new and just learning so I don't even know yet how or why you'd use a container')

            why you can change the 'text' color of a field, but not the field color fill itself seems odd.

            thanks for your help

             

             

             

            • 3. Re: changing field color
              philmodjunk

              I understood that you wanted to specify RGB colors, but it isn't something that you can do using a built in capability of FileMaker. You'd have to construct your own methods for doing that and setting things up for that could be vary labor intensive.

              You could, for example, set up a related table where a container field stores a rectangle with a specific color. 3 Number fields for the r, g and b values could be added and used in a relationshp to link a given record to it by rgb values. But you are talking about a huge table with a tremendous number of records to cover the possible range of RGB values you might want to specifiy.

              • 4. Re: changing field color
                raybaudi

                "The field showing the color would actually have no data associated with it (so maybe a 'container'. "

                No, not a container, but a simple web viewer !

                • 5. Re: changing field color
                  rdoray@charter.net

                  I guess for the time being I'll just modify the color of the text.. Maybe FM will give us the option to change the field color in future rev's.

                   

                  thanksa again for your help.

                   

                  --rob

                  • 6. Re: changing field color
                    raybaudi

                    What does prevent you from using a simple Web Viewer instead of a field?

                    • 7. Re: changing field color
                      philmodjunk

                      @raybaudi,

                      Could you post an example of how you'd do this? I'm curious to see how you'd implement this. It sounds like an excellent solution.

                      • 8. Re: changing field color
                        raybaudi

                        Hi Phil

                        Something like:

                        "data:text/html,
                        <style type='text/css'>
                        body
                        {
                        background-color:"&

                        FieldColor::RGB

                        & "}
                        </style>"

                        where FieldColor::RGB contains something like: rgb(255, 0, 0)
                        ( this code could be improved for the known problem of the WV's borders in windows )