You can have only one keyboard active at the same time, so before opening a new keyboard check if the current one is done. A way to do it nicely would be something like (code written on the fly and I'm no javascript programmer so could be some small syntax errors in it):
var text1 : string;
var text2 : string;
var isTyping : boolean;
function OnGUI() {
if (GUI.Button(Rect(10, 10, 200, 32), text1) && !isTyping) {
StartCoroutine(COInputText1());
}
if (GUI.Button(Rect(10, 50, 200, 32), text2) && !isTyping) {
StartCoroutine(COInputText2());
}
}
function COInputText1() {
isTyping = true;
var keyboard : IphoneKeyboard;
keyboard = IPhoneKeyboard.Open(text1);
yield keyboard;
text1 = keyboard.text;
isTyping = false;
}
function COInputText2() {
isTyping = true;
var keyboard : IphoneKeyboard;
keyboard = IPhoneKeyboard.Open(text2);
yield keyboard;
text2 = keyboard.text;
isTyping = false;
}
answered
Mar 09 '10 at 03:43 AM
Jaap Kreijkamp
6.5k
●
20
●
27
●
71