Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

HTML5 plugin keyboard input
Started by tntwickey Aug 02 2018 04:58 AM

- - - - -
2 replies to this topic
keydown keypress html5 plugin input

Best Answer vitaly1 , 02 August 2018 - 05:43 AM

Try to attach 'onfocus' and 'onblur' event handlers to html input:
 
// disable SDL keyboard handler and enable native JS handler 
myInputText.onfocus = function (e) {
  var jsEnableKeyboard = Module.cwrap('jsEnableKeyboard', 'null', ['number']); jsEnableKeyboard(0);
}
 
// enable SDL keyboard handler and disable native JS handler
myInputText.onblur = function (e) {
  var jsEnableKeyboard = Module.cwrap('jsEnableKeyboard', 'null', ['number']); jsEnableKeyboard(1);
}

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

tntwickey

[GLOBAL: userInfoPane.html]
tntwickey
  • Enthusiast

  • 74 posts
  • Corona SDK

I have a plugin (html5 builds) that has a html input, but all keypresses, keydowns, and keyups are caught somewhere in Corona and do not propagate down. Thus no characters are added to my plugin's input field on a keypress.

Is there a way to override this in Corona, even temporarily?

 

Sincerely,

Michael Wickey



[TOPIC: post.html]
#2

vitaly1

[GLOBAL: userInfoPane.html]
vitaly1
  • Contributor

  • 212 posts
  • Corona SDK

  Best Answer

Try to attach 'onfocus' and 'onblur' event handlers to html input:
 
// disable SDL keyboard handler and enable native JS handler 
myInputText.onfocus = function (e) {
  var jsEnableKeyboard = Module.cwrap('jsEnableKeyboard', 'null', ['number']); jsEnableKeyboard(0);
}
 
// enable SDL keyboard handler and disable native JS handler
myInputText.onblur = function (e) {
  var jsEnableKeyboard = Module.cwrap('jsEnableKeyboard', 'null', ['number']); jsEnableKeyboard(1);
}


[TOPIC: post.html]
#3

tntwickey

[GLOBAL: userInfoPane.html]
tntwickey
  • Enthusiast

  • 74 posts
  • Corona SDK

Thank-you for your quick response. That worked!

 

Sincerely,

Michael Wickey




[topic_controls]
[/topic_controls]