Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Keyboard and parameter.text questions

edited February 2017 in Questions Posts: 121

I plan to detect if return is pressed and then automatically close the keyboard. However, it seems hideKeyboard does not even work here! Why is this?

I also wanted to know how to detect multiple lines. But, how can I do any of this if I don't know where the keyboard that is active is?

function hide(uselessstring)
    --print("Testing Input:"..uselessstring)
    print(isKeyboardShowing()) --only returns false!
    hideKeyboard() --doesn't work on parameter.text's keyboard
end
function setup()
    parameter.text("mp3name","mp3name",hide)
end

Comments

  • dave1707dave1707 Mod
    Posts: 7,470

    @xThomas Try something like this. You have to call showKeyboard() before hideKeyboard() for it to work. Why, I don't know. If you want to use whatever was keyed in the parameter.text field, move it to another variable and use that variable. You need to clear "name" in this example or you'll end up in a bad loop that's hard to get out of.

    function setup()
        parameter.text("name")
        showKeyboard()
    end
    
    function draw()
        background(40, 40, 50)
        if string.sub(name,#name,#name)==RETURN then
            str=name
            name=""
            showKeyboard()
            hideKeyboard()  
        end
    end
    
Sign In or Register to comment.