[AC-1412] Cannot update Button title if disabled
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2014-08-26T04:45:10.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | TCSupportTriage, ios |
| Reporter | Braden Powers |
| Assignee | Mauro Parra-Miranda |
| Created | 2014-07-25T14:44:05.000+0000 |
| Updated | 2016-03-08T07:37:50.000+0000 |
Description
In the code, I was trying to update the title of a disabled button. If the button is disabled, the title cannot be updated. I should be able to update the button title even if disabled. There is a workaround in place, but I don't think that is necessary.
Hello, We have tested this issue. It's not a bug. You can use touchEnabled property. And if a button is touchEnabled false. We can change the Button title.
Testing Environment:
Titanium SDK: 3.3.0.GA, Titanium CLI: 3.3.0, IOS Simulator: 7.1, OS X Version: 10.9.3, Appcelerator Studio: 3.3.0Steps to Test:
1. Create a Classic project. 2. Paste this code in app.js file. 3. Run this code with the testing environmentTest Case
Thanksvar win = Ti.UI.createWindow({ title : "Button State", layout : 'vertical' }); var b1 = Titanium.UI.createButton({ color : '#fff', top : 30, width : 150, height : Ti.UI.SIZE, title : 'Test Button', touchEnabled : false, backgroundColor : 'Red' }); b1.addEventListener('click', function() { alert('I am Enabled'); }); // Create a Button. var b2 = Ti.UI.createButton({ title : 'Enable/Disable', height : Ti.UI.SIZE, width : Ti.UI.SIZE, top : 20, toggle : true }); // Listen for click events. b2.addEventListener('click', function(e) { if (e.source.toggle == true) { b1.touchEnabled = true; b1.title = 'Tuch Enable'; b2.toggle = false; } else { b1.touchEnabled = false; b1.title = 'Tuch Disable'; b2.toggle = true; } }); // Create a Button. var b3 = Ti.UI.createButton({ title : 'Title Change', height : Ti.UI.SIZE, width : Ti.UI.SIZE, top : 20, }); // Listen for click events. b3.addEventListener('click', function() { b1.title = "motiur"; }); win.add(b1); win.add(b2); win.add(b3); win.open();Please use our testcase and report back if it's not working for you.