Return "Key?"
  • raferguzmanraferguzman February 17

    Kind folks -- can anyone tell me how to detect when the return key has been pressed on the keyboard? I found a few sample codes to detect the backspace (simple enough!) but the return key eludes me.

    Thanks for any help!

    --R

  • SimeonSimeon February 17
    function keyboard(key)
        if key == "\n"
            print("Return Pressed")
        end
    end
    
  • raferguzmanraferguzman February 17

    Simeon, thanks as always -- I'll give it a try!

  • SimeonSimeon February 17

    We should add a constant like RETURN for this, as "\n" is very unintuitive. (It's simply the newline character.)

  • sanitsanit February 17

    How can we check whether the keyboard is hidden by pressing hide keyboard key? If it is hidden, we can force to show the keyboard by calling showKeyboard().

  • SimeonSimeon February 17

    @sanit I'll add a feature to determine whether it's showing.

    At the moment you can't.

  • sanitsanit February 17

    @Simeon Thank you. I think it.might be useful when working with keyboard.

  • beebee February 17

    @simeon: what if showKeyboard() and hideKeyboard() merged into single keyboard(visible: boolean) function? Visible param is to set the keyboard appearance. If no param supplied, the function returns the current keyboard appearance state.

    Hence, the keyboard() event-loop need to be renamed, for example keypressed() or keytouched(). But this will create incompatibility with old code that relies on keyboard() function.

Howdy, Stranger!

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

Sign In with OpenID Sign In with Google

Sign In Apply for Membership

In this Discussion

Tagged