Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1412] Cannot update Button title if disabled

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-08-26T04:45:10.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsTCSupportTriage, ios
ReporterBraden Powers
AssigneeMauro Parra-Miranda
Created2014-07-25T14:44:05.000+0000
Updated2016-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.

Comments

  1. Motiur Rahman 2014-08-05

    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.0

    Steps to Test:

    1. Create a Classic project. 2. Paste this code in app.js file. 3. Run this code with the testing environment

    Test Case

       var 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();
       
       
    Thanks
  2. Mauro Parra-Miranda 2014-08-26

    Please use our testcase and report back if it's not working for you.

JSON Source