11 Replies Latest reply on Mar 24, 2016 10:01 AM by debbiepa

    Want to change text color using a script

    debbiepa

      My knowledge of Filemaker is very basic. This question seems like it should be simple, but I can't seem to find an answer on this forum.

       

      In table view, I want to be able to change the color of the text I've entered from black to red without having to go to the color pallet each time. Can I make a script where, when I have the cursor in the field, and I click on command +(script number), the text in the field will change from black to red? Even if I have to highlight the text, it would still be easier to give a simple command than to go to the color pallet each time.

       

      Thanks!

        • 1. Re: Want to change text color using a script
          erolst

          If you want to colorize the entire field contents, try

           

          If [ not IsEmpty ( Get ( ActiveFieldName ) ) ]

            Set Field [ no target field ; TextColor ( Get ( ActiveFieldContents ) ; RGB ( 220 ; 0 ; 0 ) ) ]

          End If

           

          Of course, replace ( 220 ; 0 ; 0 ) with whatever RGB component values result in your desired shade of red.

          • 2. Re: Want to change text color using a script
            dtcgnet

            Why are you wanting to change the text from black to red? Depending on your reasons, there may be a better way. Also, explicitly changing the color of the text can limit your choices elsewhere.

             

            For instance, if you select text and make it red, then elsewhere in your solution, conditional formatting will not "override" the formatting you've applied.

            • 3. Re: Want to change text color using a script
              debbiepa

              @dtcgnet

              It's a flat database. I'm recording information on association members. If the information in this field has changed dramatically from last year to the current year, I like to flag it so I can go back later to call them and see if the new information is correct. Having it in red allows me to see easily which member to call.

              • 4. Re: Want to change text color using a script
                Wicktor

                In Table View -> Layout Mode select the field you want to change color.

                In Format menu bar select Conditional and then click "Add"

                Now depending on your needs you can choose Condition between "Value is" or ""Formula"

                For example if you want to change color of the field if not empty choose "Formula is" and digit Self ≠ ""

                Check the box "Text Color"

                Click the color and choose the one you like.

                • 5. Re: Want to change text color using a script
                  dtcgnet

                  Gotcha.

                   

                  Here's why I said it might limit your choices elsewhere. If you turn "Name" red by selecting the text, then formatting it as red, then it'll display as red everywhere else, too. If you jump to a layout with form letters, for instance, then Name would display in red (and you probably wouldn't want that).

                   

                  Go to a List view instead of Table view. Go to Layout. Click on the field in question, go to Format, down to Conditional. You can enter a formula, such as maybe "ABS ( DonationThisYear - DonationLastYear ) > 100" (that's just an example). In that case, any association member who'd given an amount this year that was more than $100 different than the amount given last year, the field would automatically turn red. No need to "un-red" later. You wouldn't have to do anything...FM would make the comparison and act accordingly.

                   

                  Does that sound at all like what you're after?

                  • 6. Re: Want to change text color using a script
                    debbiepa

                    Actually, my needs are way less complicated.

                     

                    I start a new database each year by saving last year's as a copy. I only change the field if the members have changed it on a paper form they send in (very low tech office here). If I see it's gone up or down a lot, I need to call them. Seeing the number in red not only flags it, but it reminds me to call them. So basically, I'm just changing the color for my own info, not for any particular amount or percentage and the old number and new number aren't different fields, it's just me changing the number in the existing field. Hope that made sense.

                    • 7. Re: Want to change text color using a script
                      debbiepa

                      Also to add, this field isn't used in any other layout.

                      • 8. Re: Want to change text color using a script
                        LOGGIX

                        In dutch version of FMPro but quite clear I guess, give it a try or get back to me.

                        Script.png

                        • 9. Re: Want to change text color using a script
                          dtcgnet

                          Open the attached and give it a shot. There are two scripts. One will colorize red, one will colorize black.

                           

                          Click in a field, and hit command 1 to turn that field red. Command 2 will turn it black.

                           

                          Each script is only two lines, so you should be able to either import the script or copy and paste the lines into scripts of your own.

                           

                          HTH

                          • 10. Re: Want to change text color using a script
                            debbiepa

                            I'd like to try that, but I can't copy and paste it and does my Filemaker understand Dutch?

                            • 11. Re: Want to change text color using a script
                              debbiepa

                              THANK YOU, Dtcgnet!! That works!

                               

                              And thanks to everyone else for your replies...much appreciated.