[TIMOB-4748] Programmatically focusing a TextArea does not work properly
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2011-10-27T14:50:46.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Sprint 2011-30, Release 1.8.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Reggie Seagraves |
| Assignee | Blain Hamon |
| Created | 2011-07-22T10:59:01.000+0000 |
| Updated | 2011-10-27T14:50:52.000+0000 |
Description
This bug originated in an email from Nolan;
Doing a programmatic focus like this does not work
text.addEventListener('click', function(){
var ta1 = Titanium.UI.createTextArea({
height:300,
width:500,
top:70,
font:{fontSize:40,fontFamily:'AppleColorEmoji'},
color:'#888',
textAlign:'left',
borderWidth:1,
borderColor:'#bbb',
borderRadius:10,
});
Create.window.add(ta1);
ta1.focus();
});
I have to do this (wrap it in a setTimeout). We need a test and a JIRA for this.
text.addEventListener('click', function(){
var ta1 = Titanium.UI.createTextArea({
height:300,
width:500,
top:70,
font:{fontSize:40,fontFamily:'AppleColorEmoji'},
color:'#888',
textAlign:'left',
borderWidth:1,
borderColor:'#bbb',
borderRadius:10,
});
Create.window.add(ta1);
setTimeout(function(){
ta1.focus();
},4);
});
Sample code to test:
var parent = Ti.UI.createWindow(); var openNewChildButton = Ti.UI.createButton({ title: 'Start' }); parent.add(openNewChildButton); openNewChildButton.addEventListener('click', function(){ var ta1 = Titanium.UI.createTextArea({height:100,width:300, top:20,font:{fontSize:40,fontFamily:'AppleColorEmoji'}, color:'#888',textAlign:'left',borderWidth:1,borderColor:'#bbb', borderRadius:10,}); parent.add(ta1); ta1.focus(); }); parent.open();Pull request 291 submitted.
Passed as expected on: iPod 3rd Gen 4.0.2 iPad 2 4.3.2 iPhone 4 4.2.10 SDK: version=1.8.0 timestamp=08/26/11 14:53 githash=8e978eb...