[TIMOB-100] Set control values dynamically after creation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:51:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 0.7.0 |
Components | iOS |
Labels | ios, iphone |
Reporter | Nolan Wright |
Assignee | Blain Hamon |
Created | 2011-04-15T02:23:39.000+0000 |
Updated | 2011-04-17T01:51:59.000+0000 |
Description
This affects:
-
textfields
-
sliders
-
switches
-
textareas
-
tabbedbars (iPhone only)
Setting values:
textfield.setValue('newValue');
Getting values:
var val = textfield.getValue();
or
var val = textfield.value;
Also, for the tabbed bar, we should probably do something like:
tabbedbar.setIndex(index);
var activeIndex = tabbedbar.index
or
var activeIndex = tabbedbar.getIndex();
While I'm working on it, I've refactored the event callback to update the proxy's value and index values so that the end dev doesn't have to. I'm not sure how we can easily avoid recursion of making .value a setter function, beyond having to backmask all the variables.
For now, I'm going to have setValue=function(arg){this.value=arg;this.update()};
wrt tabbed bar, the 'index' property is already used during initialization and in the event callback.
I usually have the properties invoke the getter/setter method so I typically don't have any recursion issues. Are you using the defineGetter and defineSetter methods for the properties?
Implemented with properties done as foo.setBar(baz) to trigger an update. doing foo.bar=baz won't trigger the update. baz=foo.bar works, but baz=foo.getBar() is not yet implemented.