Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-100] Set control values dynamically after creation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:51:59.000+0000
Affected Version/sn/a
Fix Version/sRelease 0.7.0
ComponentsiOS
Labelsios, iphone
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:23:39.000+0000
Updated2011-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();

Comments

  1. Blain Hamon 2011-04-15

    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.

  2. Don Thorp 2011-04-15

    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?

  3. Blain Hamon 2011-04-15

    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.

JSON Source