GithubHelp home page GithubHelp logo

Disable send button about tismsview HOT 8 CLOSED

sindresorhus avatar sindresorhus commented on August 22, 2024
Disable send button

from tismsview.

Comments (8)

pec1985 avatar pec1985 commented on August 22, 2024

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?

from tismsview.

sindresorhus avatar sindresorhus commented on August 22, 2024

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

from tismsview.

pec1985 avatar pec1985 commented on August 22, 2024

Will do, thanks for the idea!

from tismsview.

sindresorhus avatar sindresorhus commented on August 22, 2024

@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".

from tismsview.

pec1985 avatar pec1985 commented on August 22, 2024

Same thing, you can do "setSendButtonDissabled()" or ".sendButtonDissabled = "

But, does it matter?

from tismsview.

sindresorhus avatar sindresorhus commented on August 22, 2024

No, not really, I'm just not a fan of getters/setters.

from tismsview.

pec1985 avatar pec1985 commented on August 22, 2024

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

:)

from tismsview.

pec1985 avatar pec1985 commented on August 22, 2024

Oh, and Dissabled is with one "s", thanks for that, oops

Fixed in 73685f3

from tismsview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.