9 Replies Latest reply on Feb 27, 2014 4:59 PM by user19752

    Vertically Centered Text and Sliding

    mcrip

      Layout design is definately not my strong suit, so I'm looking for some help/suggestions on how to proceed with what I consider some more complex formatting issues (I've struggled quite a bit to get this far and have a couple of more big hurdles to overcome).

       

      Background

      As a hobby I participate (both as competitor and organizer) in TSD (Time Speed Distance) car rallies, which is a precision (not speed) course following "sport". For a number of years I have been working on expanding a rather complex excel spreadsheet that we use to produce materials for these events. This involves some rather complex time calculations, precise mileage measurements and lot of different graphics. A couple months ago I started development of a filemaker version of this, primarily driven by the desire to be able to enter data in the field (a single event may require 2-3 survey trips, to figure out the right roads, speeds, and get a final measurement) on an ipad (and get GPS location information) and remove a lot of paper from our various survey trips.

       

      Over the years we've received a number of complements on the clean, easy to read format we use (compared to what some other clubs use) so it's important to try and maintain as much consistency as possible with the current format.

       

      I've attached two files, one is a single production page from our last event (done in the excel version) and the second a single page done in the filemaker version from the planning trip for our next event (it contains instructions which may be important to organizers and workers but would not appear in a public version). Each column is a different field.

       

      What I'm trying to do is maintain a minimum row size (50 px). The problem is with the instruction/reference text. If there is a small amount of text in that field (less than the minimum row size) I would like it to be centered vertically. If there is a large amount in the field then it can be aligned to the top. The field is currently set to slide up (and resize enclosing part) with top aligned text. This works great for fields with large amounts of text but not for fields with a small amount of text. If I center the text vertically then the field does not slide. The instruction field actually occupies the whole width of the layout with enough left indent to place in on the left half of the print out. This was the only way I could get the side borders to work properly with sliding.

       

      My current thinking for solving the problem is that I'll have to create a calculation version of the text which tries to figure out how many lines it might occupy (length and number of soft returns) and pads the begining if necessary. I'd appreciate any suggestions for accomplishing this without the calculation, or suggestions/comments on how to such a calculation.

       

      As an additional complication, my second big hurdle is to be able to combine graphics and text on the print out. The attached excel version of the PDF includes an example of this, where the text references a + (intersection ahead) road sign. I think it makes more sense to post about that as a separate discussion.

        • 1. Re: Vertically Centered Text and Sliding
          mikebeargie

          Don't forget you can conditionally format the font size based on a calculation.

           

          IE:

          Length(self) > 100 --> font size = 12px

          Length(self) > 200 --> font size = 8px

           

          so on so forth. I didn't look at your files, just wanted to suggest conditional formatting if you haven't considered it.

          • 2. Re: Vertically Centered Text and Sliding
            psijmons

            would this solve your issue?

             

            Case (

            Length ( fieldtext ) < 30 ; "¶¶" & fieldtext ;

            fieldtext )

            • 3. Re: Vertically Centered Text and Sliding
              RubenVanDenBoogaard

              An other solution for the text could be to use 2 calc fields;

               

              if(length(text) <= 50 ; text ; "")   and if(length(text) > 50 ; text ; "")  and format the first to center and the second to the top and stack the fields on top of each other.

               

              About combining the graphic and text, you can also stack  a text field on top of a container field.  You can use the above trick to make 2 text calcs if you want to ofset the text when there is a graphic in the graphic field.

               

              hope that helps,

               

              Best regards,

               

              Ruben van den Boogaard

              Infomatics Software

              ruben@infomatics.nl

              • 4. Re: Vertically Centered Text and Sliding
                AlanStirling

                Hi Ruben

                 

                I have read your suggestion and wish to make the following observation ...

                 

                If one of your two fields is centred vertically, then it won't slide up. This will upset the sliding of the part boundary and cause the whole layout to malfunction. In fact the OP actually mentioned that he had found that fields centred vertically do not slide ...

                 

                In theory, your suggestion could have been useful, but in practice, I think it is no help at all.  Many new FileMaker developers rely on our help in order to learn how to use FileMaker. This is difficult enough without being mislead by unhelpful posts.

                 

                Please understand that this is definitely not meant to be a personal criticism - I just want to try to improve the standard of advice provided here. I read every post on this list - which is very time consuming and I get frustrated when I see suggestions that have obviously not been tested and just don't work.

                 

                How is the Newbie Developer going to react when the supposed solution to his problem does not work?  Firstly, the OP will worry that they might not have implemented the solution correctly and spend time trying to find where they might have made a mistake, but it is not necessarily their mistake.  Perhaps when replying to any particular question, we should include the word "Tested" or "Untested", so as to guide the OP as to the probable accuracy of each response?

                 

                Best wishes - Alan Stirling - London UK.

                • 5. Re: Vertically Centered Text and Sliding
                  user19752

                  Here is a way to calculate printing height of a field. (Tested on FM12 /windows7)

                   

                  1. set the object name of the field. (ex. text1)

                  2. set conditional formatting of the field with formula as

                  Case(Get ( WindowMode )=2; Let ( $$h[Get ( RecordID )]=GetLayoutObjectAttribute ( "text1" ; "height" ) ; 0 ) )

                  and check any style. (the formula always return 0, so this style never applyed)

                  3. walk through all pages in preview mode.(write Looping script for production)

                   

                  Now you can get "padding-top" (and -bottom) by

                  Div ( minimum_row_size - $$h[Get ( RecordID )] ; 2 )

                   

                  I haven't got how to add padding smarty since text formatting function can't set line height.

                  Prepending TextSize ( ¶ ; padding-top ) do it, but a bit larger than best size.

                  The difference is depend on the font.

                  • 6. Re: Vertically Centered Text and Sliding
                    rgordon

                    If I understand your problem correctly this looks likes perfect case to use the new Hide Object feature in fm 13. Set one copy of the field to be centered vertically and the other copy of the field to be top aligned.  Then based upon the amount of text in the field, determine which copy of the field to hide.  The hide object is one of my favorite new features in fm 13.

                    • 7. Re: Vertically Centered Text and Sliding
                      user19752

                      Good news.

                       

                      It seems that the formula in "Hide Object" is calculated before "Conditional formatting".

                       

                      center aligned "Hide object" with

                      $$h[Get ( recordID )] + 0 > 50 //min height

                      top aligned slide "Hide object" with

                      $$h[Get ( recordID )] ≠ "" and $$h[Get ( recordID )] + 0 <= 50

                       

                      (+0 means the GLOA function returns text. its better to getasnumber when setting variable.)

                       

                      I use Get(recordID) but Get(recordNumber) may be ok.

                       

                      I want field option "print all data" that auto extend field height, instead of slide to shrink.

                      • 8. Re: Vertically Centered Text and Sliding
                        rgordon

                        Do you now consider this issue to be answered?

                        • 9. Re: Vertically Centered Text and Sliding
                          user19752

                          I have tested it with only one simple example data, but I think so if mcrip can use FM13.

                          Thx.

                           

                          "print all data" option will make all things to be very simple that writing calculation and duplicating field is needless,

                          Dreamed feature for years.