PageRenderTime 31ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 12ms app.codeStats 0ms

/lib/titanium/mobile/ui/TextArea.hx

http://github.com/visup/haxe-titanium-api
Haxe | 185 lines | 50 code | 10 blank | 125 comment | 0 complexity | aecb35439b62058bb0edce9cc7621232 MD5 | raw file
  1package titanium.mobile.ui;
  2import titanium.mobile.core.BaseView;
  3import titanium.mobile.core.Dispatcher;
  4
  5/**
  6TextArea class
  7
  8Documentation available at:
  9http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TextArea-object.html
 10
 11- namespace
 12
 13Titanium.UI.TextArea
 14
 15- type
 16
 17object
 18
 19- subtype
 20
 21view
 22
 23- description
 24
 25A Text Area is created by the method `Titanium.UI.createTextArea`. The Text Area is a multiline field.
 26
 27- since
 28
 290.8
 30
 31- platforms
 32
 33android, iphone, ipad
 34
 35- properties
 36
 37enabled[boolean]: boolean indicating the enabled state of the field
 38editable[boolean]: boolean indicating if the field is editable
 39backgroundColor[string]: value of the background color of the field
 40value[string]: value of the field
 41keyboardToolbar[array]: array of toolbar button objects to be used when the keyboard is displayed
 42keyboardToolbarColor[string]: the color of the keyboard toolbar 
 43keyboardToolbarHeight[float]: the height of the keyboard toolbar
 44suppressReturn[boolean]: boolean to indicate if the return key should be suppressed during entry
 45autocapitalization[int]: One of `Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE`, `Titanium.UI.TEXT_AUTOCAPITALIZATION_WORDS`, `Titanium.UI.TEXT_AUTOCAPITALIZATION_SENTENCES`, or `Titanium.UI.TEXT_AUTOCAPITALIZATION_ALL` to indicate how the field should be capitalized during typing. (only Android)
 46autoLink[int]: whether or not to convert text within this area to clickable links.  iOS only.
 47
 48- methods
 49
 50focus: force the field to gain focus
 51blur: force the field to lose focus
 52hasText: return boolean (true) if the field has text
 53
 54- events
 55
 56focus: fired when the field gains focus
 57blur: fired when the field loses focus
 58return: fired when the field return key is pressed on the keyboard
 59change: fired when the field value changes
 60selected: fired when the text in the field is selected
 61
 62- event : selected
 63
 64range: the range of text. range is an object with the properties `location` and `length`.
 65
 66- event : change
 67
 68value: the value of the field upon change
 69
 70- event : blur
 71
 72value: the value of the field upon blur
 73
 74- event : focus
 75
 76value: the value of the field upon focus
 77
 78- event : return
 79
 80value: the value of the field upon return
 81
 82- example : Basic Text Area with Customizations
 83
 84This example created a highly customized text area.
 85
 86~~~
 87var ta1 = Titanium.UI.createTextArea({
 88	value:'I am a textarea',
 89	height:70,
 90	width:300,
 91	top:60,
 92	font:{fontSize:20,fontFamily:'Marker Felt', fontWeight:'bold'},
 93	color:'#888',
 94	textAlign:'left',
 95	appearance:Titanium.UI.KEYBOARD_APPEARANCE_ALERT,	
 96	keyboardType:Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
 97	returnKeyType:Titanium.UI.RETURNKEY_EMERGENCY_CALL,
 98	borderWidth:2,
 99	borderColor:'#bbb',
100	borderRadius:5
101});
102~~~
103
104- notes
105
106Both Text Areas and Text Fields can control the buttons displayed in a button bar above the keyboard when it's visible.
107
108Example using a custom keyboard toolbar:
109
110~~~
111var textfield = Titanium.UI.createTextField({
112	color:'#336699',
113	value:'Focus to see keyboard w/ toolbar',
114	height:35,
115	width:300,
116	top:10,
117	borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
118	keyboardToolbar:[flexSpace,camera, flexSpace,tf,flexSpace, send,flexSpace],
119	keyboardToolbarColor: '#999',	
120	keyboardToolbarHeight: 40,
121});
122~~~
123
124
125**/
126
127typedef TextAreaBlurEvent = 
128{ > Event,
129	value:String
130}
131
132typedef TextAreaChangeEvent = 
133{ > Event,
134	value:String
135}
136
137typedef TextAreaFocusEvent = 
138{ > Event,
139	value:String
140}
141
142typedef TextAreaReturnEvent = 
143{ > Event,
144	value:String
145}
146
147typedef TextAreaSelectedEvent = 
148{ > Event,
149	range:Dynamic
150}
151
152@:native("Titanium.UI.TextArea")
153extern class TextArea extends BaseView
154{
155	// static constructor
156	public inline static function create(?params:Dynamic):TextArea
157		return titanium.mobile.UI.createTextArea(params)
158		
159	// events
160	public static inline var BLUR_EVENT = "blur";
161	public static inline var CHANGE_EVENT = "change";
162	public static inline var FOCUS_EVENT = "focus";
163	public static inline var RETURN_EVENT = "return";
164	public static inline var SELECTED_EVENT = "selected";
165	
166	// properties
167	#if androidos
168	public var autocapitalization:Int;
169	#end
170	#if iphoneos
171	public var autoLink:Int;
172	#end
173	public var editable:Bool;
174	public var enabled:Bool;
175	public var keyboardToolbar:Array<Dynamic>;
176	public var keyboardToolbarColor:String;
177	public var keyboardToolbarHeight:Float;
178	public var suppressReturn:Bool;
179	public var value:String;
180	
181	// methods
182	public function blur():Void;
183	public function focus():Void;
184	public function hasText():Bool;
185}