Closed sindresorhus closed 13 years ago
I will add this to the feature request. One question, how would it be used? could you give me an example of how it should be implemented?
The Ti.UI.Button has an enabled
boolean that you can change. I've used this in the past to disable some functionality when it's temporary unavailable to the user. For example in this case, I would set the button to enabled: false
, bind to the change
event on the textArea
and then have it set to enabled: true
when the textArea
has some input.
Since the send button in this case isn't exposed as a view, you could create a property on the textArea:
textArea.sendButtonEnabled = true; // default
Will do, thanks for the idea!
@pec1985 Is it possible to set a new it to "true" later on using the property, or do I have to use the method?
var conversationView = Ti.Pedro.createSMSView({
sendButtonEnabled: false;
});
conversationView.addEventListener('change', function(e) {
if ( e.value ) {
e.source.sendButtonEnabled = true;
}
});
Also, "setSendButtonDissabled", disabled is with one "s".
Same thing, you can do "setSendButtonDissabled()" or ".sendButtonDissabled = "
But, does it matter?
No, not really, I'm just not a fan of getters/setters.
Being a fan or not of getters and setters has nothing to do with the issue.
setSomething(x)
and something = x
is the same exact thing, so either way you are calling a setter, no way around this.
For example, to populate a tableView in Titanium:
tableView.setData( array );
// or
tableView.data = array;
Getters and Setters are fun
:)
Oh, and Dissabled is with one "s", thanks for that, oops
Fixed in 73685f3791
Can you add the ability to disable/enable the send button?
Just like the SMS app. I don't want the user to be able to click the button if there is no text in the textArea.