[TIMOB-2039] TextField.enabled and TextField.editable don't work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Trivial |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2012-07-20T13:53:05.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | training |
| Reporter | PanMan |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T03:08:47.000+0000 |
| Updated | 2017-03-21T23:13:19.000+0000 |
Description
I have a textfield with both enabled and editable set to false.
However, when it's shown, it's still editable and enabled.
Code:
var tagcomment = Titanium.UI.createTextField({
value:'',
height:'35px',
width:300,
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
top:100,
hintText: 'Enter a Tag',
clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ALWAYS,
editable: false,
enabled: false
}); tagview.add(tagcomment);
I have the same problem on iPad.
Needs to be tested with permutations of editable/enabled; some of them are kind of ugly (e.g. editable=false;enabled=true).
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/75801">http://developer.appcelerator.com/helpdesk/view/75801
Sample Code for Testing All Permutations
I'm still having this issue as of sdk 1.7.1 for iphone
re-assigning for proper scheduling. this looks to be a regression?
Still a problem in 1.7.2, at least for iPhone, haven't checked Android. I'm managing to work around it now with this:
textField.addEventListener('focus', function(e) { e.source.blur(); });It is still a problem in 1.8.0.1. It's in the documentation for ages that this property is supported on iPhone, but it has never been supported. I've created some modifications in TiUITextField.h and .m file, to implement this feature. Please include it into the next release. Thanks. *TiUITextField.h:*
*TiUITextField.m:*--- /Users/wallner/Library/Application Support/Titanium/mobilesdk/osx/1.8.0.1/iphone/Classes/TiUITextField.h 2011-12-23 12:03:47.000000000 +0100 +++ /Users/wallner/Developer/Titanium/Studio/Scitec/build/iphone/Classes/TiUITextField.h 2012-01-02 08:04:42.000000000 +0100 @@ -24,8 +26,11 @@ BOOL becameResponder; NSInteger maxLength; + + BOOL editable; } +@property(nonatomic,readwrite,assign) BOOL editable; @property(nonatomic,readwrite,assign) CGFloat paddingLeft; @property(nonatomic,readwrite,assign) CGFloat paddingRight; @property(nonatomic,readwrite,assign) CGFloat leftButtonPadding; }}--- /Users/wallner/Library/Application Support/Titanium/mobilesdk/osx/1.8.0.1/iphone/Classes/TiUITextField.m 2011-12-23 12:03:47.000000000 +0100 +++ /Users/wallner/Developer/Titanium/Studio/Scitec/build/iphone/Classes/TiUITextField.m 2012-01-02 08:08:16.000000000 +0100 @@ -18,6 +20,7 @@ @implementation TiTextField @synthesize leftButtonPadding, rightButtonPadding, paddingLeft, paddingRight, becameResponder, maxLength; +@synthesize editable; -(void)configure { @@ -187,6 +190,7 @@ if ([super becomeFirstResponder]) { [self repaintMode]; + if (!self.editable) [self resignFirstResponder]; return YES; } return NO; @@ -302,6 +306,12 @@ [[self textWidgetView] setEnabled:[TiUtils boolValue:value]]; } +-(void)setEditable_:(id)editable +{ + [self textWidgetView].editable = [TiUtils boolValue:editable]; +} + + -(void)setBackgroundImage_:(id)image { UITextField *tf = [self textWidgetView];Duplicate of TIMOB-877.
Closing ticket as duplicate with reference to the above comments and links.