You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/05/15 21:00:32 UTC
[12/17] git commit: [flex-sdk] [refs/heads/develop] - Need more of
truncate code from UITextField
Need more of truncate code from UITextField
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/5b98b0c0
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/5b98b0c0
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/5b98b0c0
Branch: refs/heads/develop
Commit: 5b98b0c0bb5a40e47773b5590365db46dacb0944
Parents: 2f916c8
Author: Alex Harui <ah...@apache.org>
Authored: Tue May 14 15:55:19 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed May 15 11:57:31 2013 -0700
----------------------------------------------------------------------
.../projects/spark/src/mx/core/UIFTETextField.as | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/5b98b0c0/frameworks/projects/spark/src/mx/core/UIFTETextField.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/mx/core/UIFTETextField.as b/frameworks/projects/spark/src/mx/core/UIFTETextField.as
index ad200ee..bdef1b2 100644
--- a/frameworks/projects/spark/src/mx/core/UIFTETextField.as
+++ b/frameworks/projects/spark/src/mx/core/UIFTETextField.as
@@ -2489,6 +2489,20 @@ public class UIFTETextField extends FTETextField
super.text = s + truncationIndicator;
}
+ var otl:int = originalText.length;
+ var t:String = s;
+ while (t.length < otl)
+ {
+ t = originalText.slice(0, t.length + 1);
+ super.text = t + truncationIndicator;
+ if (textWidth + TEXT_WIDTH_PADDING <= w)
+ s = t;
+ else
+ break;
+ }
+ if (s.length > 0)
+ super.text = s + truncationIndicator;
+
return true;
}