Jump to content


Photo

web-app support?


  • Please log in to reply
6 replies to this topic

#1 OFFLINE   spinal

spinal

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • Local time: 11:55 AM

Posted 09 February 2012 - 03:52 PM

Does anyone know if it's possible for a webb app running on the iPad to have access to the iCP? I have tried in iCade and keyboard mode but I get nothing :(
I figured the following would be able to detect keypresses sent from the iCP, but I don't seem to be reading anything...

 
<html>
<head>
</head>
<body>
<div id="text">Hello</div>
 
 
<script>
var key_pressed_up = 0;
var key_pressed_down = 0;
var key_pressed_left = 0;
var key_pressed_right = 0;
 
window.addEventListener("keypress", function(event) { keyboard_hit.init(event); }, false);
 
var keyboard_hit = {
init: function(event) {
 
switch(event.keyCode)
{
case 119:
key_pressed_up = 1;
break;
case 101:
key_pressed_up = 0;
break;
case 120:
key_pressed_down = 1;
break;
case 122:
key_pressed_down = 0;
break;
case 97:
key_pressed_left = 1;
break;
case 113:
key_pressed_left = 0;
break;
case 100:
key_pressed_right = 1;
break;
case 99:
key_pressed_right = 0;
break;
default:
break;
}
// following should happen no matter what key is pressed
document.getElementById("text").innerHTML = "whatever";
}
 
}
 
</script>
 
</body>


#2 OFFLINE   milkshake

milkshake

    Super Advanced Member

  • Members
  • PipPipPip
  • 2498 posts
  • Local time: 12:55 PM
  • LocationRotherham, UK

Posted 09 February 2012 - 04:13 PM

in theory if the icp is in keyboard mode then javascript can be used to listen to keypresses like you code shows, so it should work yes.
minipandalogo.png Pandora Repo - software for your pandora :)

btn_donate_SM.gif If you like my site/contributions, consider donating.
Prometheus.jpg

#3 OFFLINE   Craigix

Craigix

    Advanced Member

  • Official OpenPandora Team
  • PipPipPip
  • 4556 posts
  • Local time: 12:55 PM

Posted 09 February 2012 - 07:26 PM

If I have time tonight I'll try this with the iCP, but remember you will need to look for both key up and key down due to the odd way the iOS input works.

#4 OFFLINE   spinal

spinal

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • Local time: 11:55 AM

Posted 11 February 2012 - 07:45 AM

Any luck with this? Or is it an iOS problem that can't be overcome?

#5 OFFLINE   Rocky5

Rocky5

    Advanced Member

  • Members
  • PipPipPip
  • 43 posts
  • Local time: 11:55 AM

Posted 11 March 2012 - 01:04 AM

Needs an input box :
<input type="text"/> & you can't auto focus on mobile safari :(

#6 OFFLINE   spinal

spinal

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • Local time: 11:55 AM

Posted 16 March 2012 - 09:55 AM

Ho, forgot about this. Yeah, I got over the problem. I now have iCP working with my (still unfinished) webapp in iCade and Keyboard modes.

#7 OFFLINE   andyjones

andyjones

    Newbie

  • Members
  • Pip
  • 1 posts
  • Local time: 05:25 PM

Posted 18 December 2012 - 07:56 AM

I tried it many times, but the problem couldn't get solved. Any body with the solution.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users