Adobe Open Source
   Home     Projects     Source     Documentation     Forums    About
Welcome Guest | Sign In
 

Gumbo FxTextArea - Functional and Design Specification



Glossary


The Glossary in the Gumbo Text Primitives spec is useful for understanding this spec.

TextView - A new Gumbo text primitive, covered in the Gumbo Text Primitives spec, which is used in skins for Gumbo's FxTextInput and FxTextArea. It provides a scrollable but chromeless rectangle of editable rich text, without background, border, or scrollbars. TextView is based on FTE and TLF, so it takes advantage of the new text capabilities in Flash Player 10.

FxTextBase - A new Gumbo base class for skinnable components whose skins contain a TextView. It is also covered in the Gumbo Text Primitives spec.

Summary and Background


Gumbo's FxTextArea allows the user to enter and edit multiple lines of rich, scrollable text. It extends FxTextBase – for details, see the Gumbo Text Primitives spec – and uses a TextView primitive in its skin to display the editable text. FxTextBase and TextView do most of the work, so understanding them first is very important.

Its default skin uses an FxScroller to support horizontal and vertical scrolling.

The displayed content is "rich", meaning that it can use all of TLF's formatting capabilities: multiple divs, paragraphs, spans, inline graphics, etc., each with their own format. The formatting is "preserved" as you edit; if you click inside some red text and type, the inserted text will be red. However, FxTextArea does not include any UI for changing the formatting; it can only be changed programmatically.

Usage Scenarios


Gumbo's FxTextArea is used in the same way as Halo's TextArea: when you need multiple lines of editable text, such as for composing a haiku.

Detailed Description


The default skin for a Gumbo FxTextArea includes a TextView as a required [SkinPart]. A typical skin for TextArea will also draw a border and opaque background using <Rect> tags, and use an <FxScroller> to provide horizontal and vertical scrollbars.

Be sure to read about what FxTextInput inherits from FxTextBase. In addition...

Like TextView, FxTextArea determines its measuredWidth and measuredHeight using the widthInChars and heightInLines properties rather than measuring the text assigned to it, because the text frequently starts out empty.

FxTextArea facades TextView's content property so that it can support rich text. It also facades the getSelectionFormat(), setSelectionFormat(), and export() methods.

FxTextArea supports both horizontal and vertical scrolling. It facades FxScroller's horizontalScrollPolicy and verticalScrollPolicy properties. To programmatically scroll, access the textView.

API Description


Class FxTextArea

package mx.components
{

public class FxTextArea extends FxTextBase
{
    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor.
     */
    public function FxTextArea()

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------

    //----------------------------------
    //  content
    //----------------------------------

    /**
     *  The textual information displayed in the TextArea.
     *
     *  You can set this property to four different things:
     *  <ul>
     *    <li>A String containing markup.</li>
     *    <li>An Array containing a Strings and FlowElements.
     *    <li>A XML instance representing a TextFlow.</li>
     *    <li>A TextFlow instance.</li>
     *  </ul>
     *  But whenever you get this property, it will be a TextFlow instance.
     */
    public function get content():Object
    public function set content(value:Object):void

    //----------------------------------
    //  heightInLines
    //----------------------------------

    /**
     *  The default height for the TextArea, measured in lines.
     *  The TextArea's formatting styles -- such as lineHeight
     *  and fontSize -- are used to determined the line height.
     *  This property is used to calculate the TextArea's measuredHeight;
     *  the measuredHeight is not determined from the text
     *  or formats in the content.
     *  It will be ignored if you specify an explicit height
     *  or a percent height.
     *
     *  @default 10
     */
    public function get heightInLines():int
    public function set heightInLines(value:int):void

    //----------------------------------
    //  horizontalScrollPolicy
    //----------------------------------

    /**
     *  See horizontalScrollPolicy for FxScroller
     */
    public function get horizontalScrollPolicy():String
    public function set horizontalScrollPolicy(value:String):void

    //----------------------------------
    //  verticalScrollPolicy
    //----------------------------------

    /**
     *  See verticalScrollPolicy for FxScroller.
     */
    public function get verticalScrollPolicy():String
    public function set verticalScrollPolicy(value:String):void
    
    //----------------------------------
    //  widthInChars
    //----------------------------------
	
    /**
     *  The default width for the TextInput, measured in characters.
     *  The width of the "0" character is used for the calculation,
     *  since in most fonts the digits all have the same width.
     *  So if you set this property to 5, it will be wide enough
     *  to let the user enter 5 digits.
     *
     *  @default
     */
    public function get widthInChars():int
    public function set widthInChars(value:int):void

    //--------------------------------------------------------------------------
    //
    //  Methods
    //
    //--------------------------------------------------------------------------

    /**
     *  Returns an Object containing name/value pairs of text formats
     *  for the selected character range.
     *  If a format is not consistently set across the entire range,
     *  its value will be null.
     *  You can specify an Array containing names of the formats
     *  that you want returned; if you don't, all formats will be returned.
     *  For example, calling
     *  <code>getSelectionFormat([ "fontSize", "color" ])</code>
     *  might return <code>({ fontSize: 12, color: null })</code>
     *  if the selection is uniformly 12-point but has multiple colors.
     *  The supported formats are those in the interfaces
     *  ICharacterFormats, IParagraphFormats, and IContainerFormats.
     */
    public function getSelectionFormat(names:Array = null):Object

    /**
     *  Applies a set of name/value pairs of text formats
     *  to the selected character range.
     *  A value of null does not get applied.
     *  For example, calling
     *  <code>setAttributes({ fontSize: 12, color: 0xFF0000 })</code>
     *  will set the fontSize and color of the selection.
     *  The supported attributes are those in the interfaces
     *  ICharacterFormats, IParagraphFormats, and IContainerFormats.
     */
    public function setSelectionFormat(format:Object):void

    /**
     *  Exports the TextView's content as XML with a <TextFlow> root tag.
     */
    public function export():XML
}

}

B Features


None.

Examples and Usage


<FxTextArea widthInChars="200" heightInLines="20" fontSize="10"/>

Additional Implementation Details


None.

Prototype Work


None.

Compiler Work


The MXML compiler has already been modified to support "mixed content".

Web Tier Compiler Impact


None.

Flex Feature Dependencies


FxTextArea is dependent on TextView.

Backwards Compatibility


Syntax changes

None.

Behavior

None.

Warnings/Deprecation

None.

Accessibility


See the TextView spec.

Performance


See the TextView spec.

Globalization


See the TextView spec.

Localization


Compiler Features

None.

Framework Features

None.

Issues and Recommendations


None.

Documentation


None.

QA


TBD


Flex SDK Project
Home
About
Versions
Downloads
Source
Bug Database
Submitting a Patch
Developer Documentation
Forums
License

Pages
Comments

Other Projects
BlazeDS
Cairngorm
Corelib
FlexUnit

More related projects ›
More Adobe projects ›
You must be logged in to comment.

 
Last Modified: 2008-10-29 11:31:34.0
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki.

Company | Online Privacy Policy | Terms of Use | Contact Us | Accessibility | Report Piracy | Permissions & Trademarks

Copyright @ 2008 Adobe Systems Incorporated.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.
Search powered by Google