{ "id": "62299", "key": "TIMOB-1667", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:58:54.000+0000", "created": "2011-04-15T02:58:52.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "eventlistener", "font", "fontsize", "label" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T22:58:36.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
Environment: Titanium Developer 1.40 and iPhone\nSimulator (iphone and iphone4). Also tested on iPhone4 device with\nsame results.
\nIssue: Changing the fontSize property of a\nlabel after label is rendered has no effect. The following code\ndoes not work.
\nExample code: (notice 2 methods for defining\nnew font size - neither work)
\n\nvar w = Ti.UI.createWindow({backgroundColor:'#fff'});\nvar b = Ti.UI.createButton({\n title:'Click Me',\n top:10,\n height:40,\n width:200\n});\nvar lab = Ti.UI.createLabel({\n text: 'test',\n top: 150,\n height: 140,\n width: 300,\n font:{fontSize:20},\n color: '#c00',\n backgroundColor: '#ccc'\n});\n\nw.add(b);\nw.add(lab);\n\nb.addEventListener('click', function() {\n lab.font = '{fontSize:100}'; \n // lab.font.fontSize = 100; // this also doesn't work\n});\n\nw.open();
\n
This should work as a workaround (it's what I've been doing,\nworks for me on both Android and iPhone):
\nlab.font = {fontSize:100};
\nI think the reason the initial attempt to just assign\nlab.font.fontSize directly doesn't work is that the 'font' property\nis implemented with getters/setters that just take and return plain\nJSON-style objects.
\nSo 'lab.font' returns a plain old object which has no inherent\nconnection back to 'lab'; changing its contents only changes the\nnew object, and doesn't ever reach the original.
\nThis could probably be made to work as expected if the font\nproperty's getter returned a proxy object, which itself would have\ngetters/setters to handle sending through the subproperties.
Since we encountered this same issue while working on StatusNet\nMobile, I'm assigning this to our support contact. Nolan, can you\nmake sure it's reassigned to the appropriate people for iPhone and\nAndroid implementations? We've used the above workaround, but\nclearly other people are encountering the same problem... if it\ncan't be fixed easily, could the workaround be added to API\ndocumentation perhaps?
\nThanks!
it's working as designed. Our properties use getters/setters, so\nthere is no support for property nesting. The font property takes\nan object as a value, so this:
\nlabel.font = {fontSize:20};
\nis the proper way to change the value.
\nthanks.
Nolan, any comment on the feasibility of my suggested\nimplementation for property nesting?
\nOr is there a deliberate choice to not implement\nproperty nesting? If so, this should be very clearly documented;\nmost JavaScript developers will probably be coming from web\ndevelopment and will be used to nested properties like\n'div.style.fontSize = 100'.
Thanks for the clarification Nolan. I see I was mistakenly\nwrapping the object in ''. I agree on needing better documentation.\nI also realize you guys are busy. Time to get a few interns :)
Nolan should have invalidated.