8 Replies Latest reply on May 16, 2011 11:58 AM by yenner58

    How do I tell a field to automatically resize the font to fit the field box?

    yenner58

      Title

      How do I tell a field to automatically resize the font to fit the field box?

      Post

      NEW POST for help

      I  am in need of assitance the tag resize process does not work for me  anymore.  I do not know how to copy in here the Script and it is rather  long to type, I have a series of 3 screen shots with the process, I have attached one but don't know how to post all three.  Any  suggestions?

      Thanks, Melinda

      One of the layouts I use is for nametags and the tags are sometimes to long for the field so I have to manually go in and resize 2-4 nametags out of the 30-40 each training.  Is there someway to automatically have the field decrease the font to fit?

      Thanks, Melinda 

        • 1. Re: How do I tell a field to automatically resize the font to fit the field box?
          Orlando
            

          Hi Melinda and welcome to the forum.

           

          I was testing something similar recently and this is the process I came up with.

           

          First on your name tag layout, I assume you have a single record per name tag and you are printing as labels or a list, go into Layout Mode and give your NameTag field an object name, in this case "Tag", to do you need to display the Object Info pallet 'View > Object Info' select your NameTag field and then input the name into the 'Object Info' field at the top of the pallet. 

           

          Next you need to make a note of the default font size for the NameTag field.

           

          then you need to write the following script:

           

          TagProcess

           

          #
          Go to Record/Request/Page [First]
          Commit Records/Requests [ Skip data entry validation; No dialog ]
          # Set Variables to the Tag sizes
          Set Variable [ $StartSize ; 72 ] // Change this to the Default size of the field
          Set Variable [ $StaticHeight ; GetLayoutObjectAttribute ( "Tag" ; "Bounds" ) ] 
          Loop
          #
          Set Variable [ $LoopCount ; 0 ] 
          Loop 
          Go to Field [ TABLE::Text ] // Make sure to tick Select/perform
          Set Variable [ $ActiveHeight ; GetLayoutObjectAttribute ( "Tag" ; "Bounds" ) ] 
          Exit Loop If [ $StaticHeight = $ActiveHeight ] 
          Set Variable [ $LoopCount ; Value:$LoopCount + 5 ] 
          Set Field [ TABLE::Text ; TextSize ( TABLE::Text ; $StartSize - $LoopCount ) ] 
          Commit Records/Requests [ Skip data entry validation; No dialog ] 
          End Loop 
          #
          Go to Record/Request/Page [ Next ; Exit after last ] 


          End Loop 

           

          What is happening is the script sets two variables at the start, one is the Default font size and the second is the measurements of the field boundaries when the field is not active, then it loops through each Tag record, entering into the field, and if the text is bigger than the field the boundaries will expand, and then compares the measurements. If the measurements are different then it reduces the default font size by the number of times it has looped through, and when the measurements do match then it moves on to the next record and starts again.

           

          I hope this makes sense and does the trick for you, do ask if anything needs further explanation




          • 2. Re: How do I tell a field to automatically resize the font to fit the field box?
            yenner58
              

            OK I gave it my best shot, I don't understand scripts, here is what I have:

             

            Go to Record/Request/Page [First]

            Commit Records/Requests [Skip data entry validation]

            Set Variable [$to the tag sizes]

            Set Variable [$StartSize 48]

            Set Variable [$Name Tag; Value:"[$StaticHeight ; GetLayoutObjectAttribute ( Name Tag ; Bounds)]"]

            Loop

            Set Varibale [$LoopCount : 0]

            Loop

            Go to Field [Select/perform; Texas Data 5-04::Name Tag]

            Set Variable []

             

            When I get to the last one it will not let me finish the script like you have it without an operator??

             

            Also you have # and on yours and I cannot get it to take them, also in the first Set Variable you have # Set Variable to the tag size but it would only let me do it as I typed it and them the next Set Variable you have a : but it would not let me do this either....

             

            Can you help me??

             

            Thanks Melinda 

            • 3. Re: How do I tell a field to automatically resize the font to fit the field box?
              Orlando
                

              Hi Melinda

               

              I have modified my test file to match what I think are your table and field names so you can see how it works and import it into your file if you need to.

               

              The file can be downloaded from here: http://dl.getdropbox.com/u/552420/FileMakerForumDemos/LabelProcessDemo.fp7 

               

              If you have any other questions or problems with the file then let me know and I will try to explain. 

              • 4. Re: How do I tell a field to automatically resize the font to fit the field box?
                yenner58
                  

                hhhmm still stumped I did change the size to 48 from 72, I also email a small clone of my database in reply to the email, will you get it?

                 

                • 5. Re: How do I tell a field to automatically resize the font to fit the field box?
                  Orlando
                    

                  Sorry this has not worked, unfortunately no I would not get the email. I will however send you a private message with me email address for you to email the file over and I will have a look for you. 

                  • 6. Re: How do I tell a field to automatically resize the font to fit the field box?
                    yenner58
                      

                    perfect, thanks do you have my email?

                     

                    • 7. Re: How do I tell a field to automatically resize the font to fit the field box?
                      Orlando
                         No email yet, did you get my private message? Link with envelope top right of the page.
                      • 8. Re: How do I tell a field to automatically resize the font to fit the field box?
                        yenner58

                        I am in need of assitance the tag resize process does not work for me anymore.  I do not know how to copy in here the Script and it is rather long to type, I have a series of 3 screen shots with the process.  Any suggestions?

                        Thanks, Melinda