AnsweredAssumed Answered

Change font size using a script

Question asked by layotte on Nov 18, 2013
Latest reply on Nov 18, 2013 by philmodjunk

Title

Change font size using a script

Post

     I am using the FTS Meetings file to add text editing to my solution. In addition to the plain, italics, bold, red and bullet they already have I would like to add the ability for the user to change the font size on Filemaker Go.  I have done this by adding a Small, Medium and Large button to the layout and setting the TextSize as shown below.  Instead of using multiple buttons I would like to use a dropdown where the user can select the size then select the text and use a button to make the changes.  I have tried adding a GetField in the script to the area where the font size is listed but can't get it to work.  Any suggestions?

     Let ( [
         allText = Get (ActiveFieldContents) ;
         start = Get ( ActiveSelectionStart) ;
         size = Get (ActiveSelectionSize) ;
         selectedText = Middle ( Get ( ActiveFieldContents ) ; start ; size ) ;
         style = Get ( ScriptParameter )  ;

         replacementText = Case (
                                           style = "Small"; TextSize ( selectedText ; 10 ) ;
                                           style = "Medium"; TextSize ( selectedText ; 12 ) ;
                                           style = "Large"; TextSize ( selectedText ; 18 ) ;
                                           TextStyleAdd ( selectedText ; Evaluate (style) )
                                       )
      ] ;

        Left ( allText ; start - 1 ) &  replacementText &   Right ( allText ; Length ( allText ) - (start + size -1))
     )

Outcomes