Created
September 18, 2009 23:35
-
-
Save Shadowfiend/189355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fixes some issues where SuperTab has trouble editing labels that have | |
* been truncated. | |
* | |
* The original SuperTab uses the same textField used by regular tabs to | |
* _display_ the label to edit it, as well, simply setting it to an | |
* editable text field instead of merely a dynamic one. However, when | |
* the tab truncates the text of the field for width, and then is edited | |
* again, this means that the text in the editable field is truncated. | |
* | |
* This quick override simply restores the text by reading from the | |
* tab's label proeprty, which is never truncated, and resetting the | |
* selection to cover the newly expanded text. | |
*/ | |
override public function set editableLabel(value:Boolean):void | |
{ | |
var changed:Boolean = value != editableLabel; | |
super.editableLabel = value; | |
if (changed && value) | |
{ | |
// Undo truncation for editing and redo selection for the new | |
// text length. | |
this.textField.text = this.label; | |
this.textField.setSelection(0, textField.length-1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment