Titanium - How do I prevent the textField losing focus when pressing return

I'm using the titanium API to write an iOS app in javascript. The problem I ran into is that when I have a text field and I click on it to type in, I want to be able to press the return key without blurring the focus on the text field thus minimising the keyboard. I want to be able to press return and keep the keyboard open. Does anyone have a suggestion? (Immediately re-focussing the text field on the 'return' event is ugly and not at all what I was hoping for)

Here's a brief bit of code to recreate this issue:

    var win = Ti.UI.createWindow({backgroundColor: 'white'});

    var textBox = Ti.UI.createTextField({
      borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
      width: 240, height: 30,
      top: 30, left: 10
    });

    textBox.addEventListener('return', someFunction());

    win.add(textBox);
    win.open();

Answers


Try using the textArea instead of textBox but style it the same. Then handle the behaviour you want when the user presses the return key.


Need Your Help

Equivalent function to C's "_getch()" in Java?

java c getch

I use Google Wave, and I want to emulate the ability to send messages before you actually hit the enter key.