Add missing setX and X methods on CPControl.

Moved the logic for setStringValue to setObjectValue on CPTextField.
Now, all setX's call setObject.  We store native objects, and cast
to the appropriate type in the getter methods.
This commit is contained in:
Ross Boucher
2008-09-14 13:40:58 -07:00
parent 0ffbca776f
commit bf9ffb8a95
2 changed files with 77 additions and 8 deletions
+12 -7
View File
@@ -432,23 +432,28 @@ var _CPTextFieldSquareBezelColor = nil;
return [[self class] _inputElement].value;
#endif
return [_value string];
return [self stringValue];
}
/*
Sets the string the text field.
@ignore
*/
- (void)setStringValue:(CPString)aStringValue
- (void)setObjectValue:(id)aValue
{
_value = aStringValue;
[super setObjectValue:aValue];
#if PLATFORM(DOM)
var cssString = _value ? [_value cssString] : @"";
var displayString = "";
if ([aValue respondsToSelector:@selector(string)])
displayString = [aValue string];
else
displayString += aValue;
if (CPFeatureIsCompatible(CPJavascriptInnerTextFeature))
_DOMTextElement.innerText = cssString;
_DOMTextElement.innerText = displayString;
else if (CPFeatureIsCompatible(CPJavascriptTextContentFeature))
_DOMTextElement.textContent = cssString;
_DOMTextElement.textContent = displayString;
#endif
}