1

I am writing a game programming library in JavaScript, and I am trying to make use of the iCade on the iPad platform. I actually got it working through a rather hacky solution. However, it's not quite there yet.

iCade uses keyboard presses to translate. The problem with that is I am having trouble attaching keyboard events to things other than input elements. My first question would be is there a way to attach keyboard events to something that isn't a text input element?

So instead, I attached it to a element. I made the element opacity 0, width/height 0, and pushed the z index way to the back, and focus it. Worked alright, except it's kinda hacky, but still it's there. However, when the element is focused (and bluetooth is not on) the soft keyboard comes up. Furthermore, when the iCade/bluetooth is enabled, the keyboard goes away, but you still are stuck with the form assistant bar (Previous/Next) at the bottom of the browser. It's ugly and it gets in the way of my display. My second question would be is there anyway to either defocus the soft keyboard but retain the key events of the input, or maybe just hide the bottom input bar in the browser?

Also, solutions should not involve jQuery. I've written everything in my game library without the need for jQuery.

UPDATE: I have figured out a cleaner looking way to implement the input field. With that said, I would like to add a third question: If the 1st and 2nd questions can't be done, is there any way to make the translucent form assistant bar at the bottom of the iPad browser window disappear? If that's possible then my mission will be 100% complete.

Marc Marta
  • 542
  • 2
  • 10
  • I'm not sure if this would work or not, and I'm not in a position right now to test it, but `e.preventDefault()` could fix it. – pandavenger Jun 10 '13 at 17:01
  • I tried this in the focus event listener for the textarea, and it did not work. – Marc Marta Jun 10 '13 at 17:09
  • http://stackoverflow.com/questions/3539292/ipad-web-application-how-do-i-prevent-the-keyboard-from-popping-up-on-jquery-da This might help – pandavenger Jun 10 '13 at 17:22
  • Unfortunately this is a native component, not a jQuery UI widget. There is no "beforeShow" event. Even when you do disable, readonly, or even hide the textarea on focus, it still brings up the keyboard with the previous/next/done bar. – Marc Marta Jun 10 '13 at 17:39

1 Answers1

0

Apparently, after researching it, this is not possible - only OS calls can do this, and none of them have a JS interface, even via webkit. What I will do is give the option to modify the canvas size for the bar.

Marc Marta
  • 542
  • 2
  • 10