Spark NumericStepper - Functional and Design SpecificationSpark NumericStepper - Functional and Design Specification | Summary and Background | Usage Scenarios | Detailed Description | API Description | B Features | QA
Summary and BackgroundNumericStepper is a Spinner that has a TextInput companion. It extends Spinner and adds a TextInput as a required SkinPart. The numeric behavior of NumericStepper is exactly the same as Spinner. The scale is the same. The only additional behavior is that users may use the TextInput to edit the value. Usage ScenariosAllow users to specify a quantity either through the editable text field or to step the value via the arrow buttons. Detailed DescriptionBehaviorSee Spinner for detailed description of NumericStepper's behavior in terms of scale. SkinPartsSee Spinner for button SkinParts.
Editing the Text FieldNumericStepper specifies an editable text field as a SkinPart called textInput. If textInput is edited, the new value is committed once the user performs an action that does not edit the text. These actions include:
The value of textInput is committed and then stepped regardless of whether step() is called programmatically or through user interaction. EventsWhenever the value changes, a "valueCommit" event is dispatched (inherited from Range). Keyboard BehaviorvSpinner's keyboard controls still apply (except for Left and Right since they navigate the TextInput), but now, the text field can be edited. The value of the text field is committed whenever the user hits enter, focuses out of the NumericStepper using tab, or presses either of the buttons through up or down. FocustextInput always has focus when NumericStepper is in focus. Not yet implemented features-maxChars property API Descriptionpackage spark.components { import flash.display.DisplayObject; import flash.events.Event; import mx.events.FlexEvent; import mx.managers.IFocusManagerComponent; /** * The NumericStepper control lets the user select * a number from an ordered set. * The NumericStepper control consists of a single-line * input text field and a pair of arrow buttons * for stepping through the possible values. * The Up Arrow and Down Arrow keys also cycle through * the values. An inputted value is committed whenever * the user presses enter, focuses out of the * NumericStepper, or steps the NumericStepper. * * @see spark.components.Spinner */ public class NumericStepper extends Spinner implements IFocusManagerComponent { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor */ public function NumericStepper(); //-------------------------------------------------------------------------- // // SkinParts // //-------------------------------------------------------------------------- [SkinPart] /** * <code>textInput</code> is a SkinPart that defines a * TextInput which allows a user to edit the value of * the NumericStepper. The value is rounded and committed * when the user presses enter, focuses out of * the NumericStepper, or steps the NumericStepper. */ public var textInput:TextInput; //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * @private */ override protected function partAdded(partName:String, instance:*):void; /** * @private */ override protected function partRemoved(partName:String, instance:*):void; /** * @private */ override protected function enableSkinParts(value:Boolean):void; /** * @private */ override public function setFocus():void; /** * @private */ override protected function isOurFocus(target:DisplayObject):Boolean; /** * @private * Calls commitTextInput() before stepping. */ override public function step(increase:Boolean = true):void; /** * Commits the current text of <code>textInput</code> as * <code>value</code> after rounding the new value using * <code>nearestValidValue</code>. */ protected function commitTextInput():void; //-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- //--------------------------------- // Keyboard handlers //--------------------------------- /** * When the enter key is pressed, NumericStepper commits the * text currently displayed. */ protected function textInput_enterHandler(event:Event):void; } } B FeaturesQAYes |
|
| You must be logged in to comment. |
|---|
