8 Replies Latest reply on Sep 15, 2013 9:22 AM by philmodjunk

    Changing the way fields look like using scripts

    kopeltd

      Title

      Changing the way fields look like using scripts

      Post

           Hi everyone.

            

           I am trying to write a script that will change color of my object or field. The only thing i can do at the minute is to insert picture. My problem is that I need this field or object to be empty inside so i can see what is behind it. I need to change color of the border only using script.

           Any suggestion greatly appreciated.

           Lucas.

        • 1. Re: Changing the way fields look like using scripts
          philmodjunk

               If you have to be able to see behind it, how can you change the color and still do that? The object would have to be transparent.

               What you can do:

               Take a button, tab control, field object or layout text object and right click it while in layout mode.

               Select "Conditional Format".

               Enter an expression such as:

               $$ColorChange

               Specify a format for this. You can change the fill color, the text color or one of the text formats. You cannot change the border's appearance this way.

               In your script, you can do this:

               Set Variable [$$ColorChange ; value: True ]
               Refresh Window []

               to make the conditional format apply. That example is just an "on or off" example. By assigning more values than True/false (1, or 0), you can stack up several different expressions such as:

               $$ColorChange = "Red"

               And get a number of different appearance changes by setting the global variable to a different value.

               In a list or table view, you might want this specific to just one row (record) in your found set. In that case, use a field instead of the variable and use set field to change the field's value.

               I've been able to simulate a border color change in a conditional format by changing the fill color of a field or button stacked behind another object that had an opaque fill color. The second option is 2 pixels smaller in both length and width and centered on the object behind it. Thus, the fill color change looks like a border color change.

               Note that conditional formatting does not work for Instant Web Publishing clients. (Those using a web browser to access the database.) But there are ways to change a field's appearance with container fields and calculations--how we used to do this before we had the option of using conditional formatting.

          • 2. Re: Changing the way fields look like using scripts
            kopeltd

                 Thanks a lot Phil for your answer. That answers a lot of questions.

                 My problem is that my background is in .jpg format. I can't place anything behind it. I still need to highlight some stuff on this file while change other entries in my database. Border color change would be the easiest option. I can keep field transparent and then just change border color if requested by database. 

                 Can you think of any others ideas. I don't really want to go that root with creating lots of different small fields and changing their fill in order to visualize border color. 

                 Any suggestions greatly appreciated.

                 Lucas

                 P.S. Are there any other standard file extensions that File Maker will support their layers in order to move objects behind it or in front of it?

            • 3. Re: Changing the way fields look like using scripts
              philmodjunk
                   

                        My problem is that my background is in .jpg format. I can't place anything behind it.

                   I'm not suggesting that you place anything behind it. You would place objects in front of it. Unless this is just a static picture that never changes, you must already have fields in front of the jpg background. I recommend that you not try to change border colors--it's just too complex and "finicky" a thing to make work.  Instead, I suggest that you take the fields that you already have in place in front of this background and use conditional formatting to either show a faint "pastel" fill color, or a change in text color when you need to "highlight" a particular field on the layout.

              • 4. Re: Changing the way fields look like using scripts
                kopeltd

                     Great. Thanks Phil for another good answer.

                     I need to be able to highlight the part on that jpeg file only when other field in database will say so. Never actually work with conditional formatting. Can you guide me somewhere to read more about. Or maybe you could give me an idea of how to set it up.

                     Example:

                     Filed one say = Yes ---> Field two change color.

                      

                     Thanks for any help.

                      

                     Lucas

                • 5. Re: Changing the way fields look like using scripts
                  philmodjunk

                       I believe that my original post already gave you most of the step by step directions for that.

                       Enter layout mode

                       Right click field 2

                       Select Conditional Format

                       Click New and select the "Formula" option instead of "value".

                       Enter an expression that evaluates as true whenever you want the conditional format to apply.

                       If Field 1 is a text field and you want the color to change if it has the word "yes", the expression might look like this:

                       YourTableOccurrenceName::Field 1 = "Yes".

                       This is also something you can look up in FileMaker Help.

                       PS. you really could use conditional formatting, a good image editor and a lot of patience/time to get what simulates a transparent field with a border that appears/disappears as controlled by a conditional format expression that produces a fill color, but each such field would require a "layer cake" of 4 objects: Jpg background, Transparent field with conditional format that changes it to a solid color, small jpg copied from background centered on conditionally formatted field followed by your actual transparent data field located on top.

                       That small jpg has to be very precisely selected and copied from the backgound image and equally precisely positioned on your database layout to create the illusion of a conditionally formatted field border so this adds up to a lot of time for this to work for even a modest number of fields...

                  • 6. Re: Changing the way fields look like using scripts
                    kopeltd

                         Thank you Phil very much.

                          

                         Back to work

                          

                         Lucas

                    • 7. Re: Changing the way fields look like using scripts
                      kopeltd

                           Hi again.

                           Thanks to Phil i have managed to get what i wanted. 

                           Now i got another problem. My highlights on my jpg background only stay there if i am in actual record related to the highlighted area. As soon as i move to other record my highlighted area goes back to normal. I would like it to stay highlighted until i say differently. I am using conditional formating. Each of my record has got field that creates a serial number. My condition formating formula looks like:

                           Serial number field="1" and Finished field="yes"

                           then my text color changes.

                           Thanks for any response.

                           Lucas

                      • 8. Re: Changing the way fields look like using scripts
                        philmodjunk

                             If you your conditional format expressions refer to data in fields, then changing records means you may have different data in those fields and thus the conditional format may change.

                             If that is not what you want, then use global variables or global fields so that you can set a value used for the conditional format expression that will not change when you change records.