Created
June 4, 2012 12:13
-
-
Save iskugor/2867975 to your computer and use it in GitHub Desktop.
Titanium WTF: Window children property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var win = Ti.UI.createWindow({ backgroundColor: "#fff", navBarHidden: true, layout: 'horizontal' }); | |
| var view = Ti.UI.createView({ | |
| layout: 'horizontal' | |
| }); | |
| var label1 = Ti.UI.createLabel({ | |
| top: 150, | |
| left: 50, | |
| text: 'Testing 1 ...', | |
| height: '75dp', | |
| width: '50%', | |
| backgroundColor: "#000" | |
| }); | |
| var textField = Ti.UI.createTextField({ | |
| top: 150, | |
| left: 50, | |
| width: '150dp', | |
| height: '75dp', | |
| }); | |
| var label2 = Ti.UI.createLabel({ | |
| top: 150, | |
| left: 50, | |
| text: 'Testing 2 ...', | |
| height: '75dp', | |
| width: '50%', | |
| backgroundColor: "#000" | |
| }); | |
| var picker = Ti.UI.createPicker({ | |
| top: 150, | |
| left: 50, | |
| height: '75dp', | |
| backgroundColor: "#999", | |
| selectionIndicator : true | |
| }); | |
| var data = []; | |
| data[0] = Ti.UI.createPickerRow({ title:'Bananas' }); | |
| data[1] = Ti.UI.createPickerRow({ title:'Strawberries' }); | |
| data[2] = Ti.UI.createPickerRow({ title:'Mangos' }); | |
| data[3] = Ti.UI.createPickerRow({ title:'Grapes' }); | |
| picker.add(data); | |
| view.add(label1); | |
| view.add(textField); | |
| view.add(label2); | |
| view.add(picker); | |
| win.add(view); | |
| win.addEventListener('open', function() { | |
| Ti.API.info('View'); | |
| Ti.API.info(typeof view.children); // "object" - should be "[object Array]" | |
| Ti.API.info(typeof view._children); // "undefined" - OK | |
| Ti.API.info(view.children.length); // "4" - OK | |
| Ti.API.info('Window'); | |
| Ti.API.info(typeof win.children); // "object" - should be "[object Array]" | |
| Ti.API.info(typeof win._children); // "object" - should be "undefined" | |
| Ti.API.info(win.children.length); // "0" - should be "1" | |
| Ti.API.info(win._children.length); // "1" - should throw an exception since "_children" should be undefined | |
| }); | |
| win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, no worries, I was going through your public gists and came across this one. :) Thats all.
The
_childrenyou are talking about, could be some private Titanium API, I mean, internal that somehow found its way to the JS.