Skip to content

Instantly share code, notes, and snippets.

@Shadowfiend
Created September 18, 2009 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shadowfiend/189355 to your computer and use it in GitHub Desktop.
Save Shadowfiend/189355 to your computer and use it in GitHub Desktop.
/**
* 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