title: Shorten a label in Firemonkey with ellipsis
body: <p>Is there an ellipsis / ellipsify routine for shortening button or label text in Firemonkey?
  eg, to turn:</p>
  
  <p><strong>"C:\a really\really\really long\very long path\even longer path name"</strong>
  into
  <strong>"C:\a really\re..."</strong>
  or
  <strong>"C:\a really\re...path name"</strong></p>
  
  <p>There are routines around for VCL but it looks like finding Firemonkey's text size will be more involved.</p>
  
  <p>I am using Firemonkey 2 on Delphi XE3</p>
  
  <p>Thanks in advance</p>
  
  <p>... Ok I've created a clunky procedure from Mike Sutton's advice.
  It only adds the ellipsis at the end of the 1st part of the string but could be modified quite easily for middle or end ellipsis positions. It also takes into account the current objects Font size and style.</p>
  
  <p>Usage would be:</p>
  
  <pre><code>ShortenText(Button1, 'Start of text blah blah blah blah the END is here');
  
  procedure ShortenText(anFMXObject: TTextControl; newText: string);
  var
    aTextObj: TText;
    shortenTo: integer;
    modText: string;
  begin
    if Length(newText) &gt; 2 then
    begin
      modText:= newText+'...';
      aTextObj:=TText.Create(anFMXObject.Parent);
      aTextObj.Font.SetSettings(anFMXObject.Font.Family,
                            anFMXObject.Font.Size,
                            anFMXObject.Font.Style);
      aTextObj.WordWrap:= false;
      aTextObj.AutoSize:= true;
      aTextObj.Text:= newText;
      // this next bit generates the change necessary to redraw the new text (bug in XE3 as of Oct 2012)
      aTextObj.HorzTextAlign:= TTextAlign.taCenter;
      aTextObj.HorzTextAlign:= TTextAlign.taLeading;
      // now shorten the text:
      shortenTo:= round((Length(modText)/aTextObj.Width)*anFMXObject.Width)-1;
      modText:= LeftStr(modText, shortenTo-3)+'...';
      anFMXObject.Text:= modText;
      FreeAndNil(aTextObj);
    end;
  end;
  </code></pre>