native.newTextField() for Windows

** UPDATE: This has been released **

Mine:  http://github.com/roaminggamer/RGEasyTextField/

Jason Schroeder released an alternate solution here:  http://forums.coronalabs.com/index.php?app=core&module=attach&section=attach&attach_id=4193 (if link fails, page down to Jason’s attachment)

Hello folks.  Recently, I answered a thread here, asking about native.newTextField() support on Windows desktop builds: 

https://forums.coronalabs.com/topic/57623-support-for-nativenewtextfield/

I’ve put together a library to enable ‘fake’ keyboard input into a text field.

https://www.youtube.com/watch?v=MkDse2Pnac4

Right now I have some beta-testers whacking on it and they will be posting their questions here.  This way everyone can benefit from the questions once the library is released, and so I have a single place to answer questions (not in my inbox). :slight_smile:

Thanks,

Ed

 Great Job, Ed.

Could you please email me the beta version so I can do some test?

Sorry for annoying you.

Thank you.

It’s funny that this thread has popped up when it did, as I just last week started working on a module to add “faked” support for native.newTextField() and native.newTextBox() in the Windows simulator. Ed and I have corresponded on this, and it seems like he and I are taking slightly different approaches to the problem, so with his blessing (I didn’t want to steal anybody’s thunder or step on toes), I’m going to make my own solution available here, and on my website later this week, once I have time to compose a blog post around it.

There is a sample project that shows off the various methods and parameters you can apply or adjust to native text inputs attached to this post. You can load that up in the simulator to check it out, or if you want, just copy “windowsText.lua” from that sample project folder and require it into your own project.

The module is only lightly commented, but there is a “how to” section at the top of it. I’ve copied that text at the bottom of this post. The module is set up to overwrite the default native.newTextField() and native.newTextBox() APIs, so you don’t need to change any of your code to use it. If you are running in the Windows simulator, it’ll use the faked APIs - if you are running it on any other platform, it’ll use the native versions. But you can override this behavior by calling windowsText.enable() to force the faked versions on a non-Windows platform, and windowsText.disable() to revert back to the native APIs. The faked text input objects dispatch “userInput” events identical to those put out by their native counterparts, so if you have event listeners for your input fields, they’ll work just fine.

I probably won’t be doing too much support for this module, as it’s not something that would be used in a released app (it’s just a tool to enable text input in the simulator, after all), but if you find any bugs please let me know and I’ll do my best to fix them. In my testing, it works pretty much as advertised, though. Hope some of you find it useful!

-Jason

https://www.youtube.com/watch?v=sPIiMMSb_9E

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* windowsText module for Corona SDK Copyright (c) 2015 Jason Schroeder http://www.jasonschroeder.com http://www.twitter.com/schroederapps \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ABOUT THE MODULE: This module was created to "fake" native text input on the Corona Simulator for Windows, which as of July 2015 does not support the native.newTextBox() and native.newTextField() APIs. You are welcome to modify it as needed, but it is set up to "just work" by requiring it into your Corona project. Once required, the module will check to see if the project is running in the Windows simulator, and if it is, it will overwrite native.newTextBox() and native.newTextField() with these non-native Windows simulator-compatible functions. These modified functions are fully compatible with all syntax and methods of their native counterparts, so you will not need to alter your code at all to support them. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* HOW TO USE THE MODULE: 1.) Place windowsText.lua (this file) in your project's root directory (where your main.lua resides) 2.) Require the module by placing the following code in your main.lua: local windowsText = require("windowsText") 3.) That's it! Calling native.newTextField() or native.newTextBox() will now work in the Windows Simulator just like it does on-device or in OS X. 4.) If you want to use these non-native textFields or textBoxes outside the Windows simulator, you can optionally call windowsText.enable() to overwrite the native functions. You can revert back to the native APIs by calling windowsText.disable() if you wish. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

Thanks Jason!  

I am glad to see other solutions to a common problem.  This way, if folks don’t like my solution, they can use yours and vice versa.  Oh, and if they like neither, at least they’ll be armed with enough info to try coding their own.

FYI, I’ll try to release mine publicly later today.

Cheers,

Ed

Hi guys and gals.  My library is now updated and available here:

http://github.com/roaminggamer/RGEasyTextField/

 Great Job, Ed.

Could you please email me the beta version so I can do some test?

Sorry for annoying you.

Thank you.

It’s funny that this thread has popped up when it did, as I just last week started working on a module to add “faked” support for native.newTextField() and native.newTextBox() in the Windows simulator. Ed and I have corresponded on this, and it seems like he and I are taking slightly different approaches to the problem, so with his blessing (I didn’t want to steal anybody’s thunder or step on toes), I’m going to make my own solution available here, and on my website later this week, once I have time to compose a blog post around it.

There is a sample project that shows off the various methods and parameters you can apply or adjust to native text inputs attached to this post. You can load that up in the simulator to check it out, or if you want, just copy “windowsText.lua” from that sample project folder and require it into your own project.

The module is only lightly commented, but there is a “how to” section at the top of it. I’ve copied that text at the bottom of this post. The module is set up to overwrite the default native.newTextField() and native.newTextBox() APIs, so you don’t need to change any of your code to use it. If you are running in the Windows simulator, it’ll use the faked APIs - if you are running it on any other platform, it’ll use the native versions. But you can override this behavior by calling windowsText.enable() to force the faked versions on a non-Windows platform, and windowsText.disable() to revert back to the native APIs. The faked text input objects dispatch “userInput” events identical to those put out by their native counterparts, so if you have event listeners for your input fields, they’ll work just fine.

I probably won’t be doing too much support for this module, as it’s not something that would be used in a released app (it’s just a tool to enable text input in the simulator, after all), but if you find any bugs please let me know and I’ll do my best to fix them. In my testing, it works pretty much as advertised, though. Hope some of you find it useful!

-Jason

https://www.youtube.com/watch?v=sPIiMMSb_9E

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* windowsText module for Corona SDK Copyright (c) 2015 Jason Schroeder http://www.jasonschroeder.com http://www.twitter.com/schroederapps \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ABOUT THE MODULE: This module was created to "fake" native text input on the Corona Simulator for Windows, which as of July 2015 does not support the native.newTextBox() and native.newTextField() APIs. You are welcome to modify it as needed, but it is set up to "just work" by requiring it into your Corona project. Once required, the module will check to see if the project is running in the Windows simulator, and if it is, it will overwrite native.newTextBox() and native.newTextField() with these non-native Windows simulator-compatible functions. These modified functions are fully compatible with all syntax and methods of their native counterparts, so you will not need to alter your code at all to support them. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* HOW TO USE THE MODULE: 1.) Place windowsText.lua (this file) in your project's root directory (where your main.lua resides) 2.) Require the module by placing the following code in your main.lua: local windowsText = require("windowsText") 3.) That's it! Calling native.newTextField() or native.newTextBox() will now work in the Windows Simulator just like it does on-device or in OS X. 4.) If you want to use these non-native textFields or textBoxes outside the Windows simulator, you can optionally call windowsText.enable() to overwrite the native functions. You can revert back to the native APIs by calling windowsText.disable() if you wish. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

Thanks Jason!  

I am glad to see other solutions to a common problem.  This way, if folks don’t like my solution, they can use yours and vice versa.  Oh, and if they like neither, at least they’ll be armed with enough info to try coding their own.

FYI, I’ll try to release mine publicly later today.

Cheers,

Ed

Hi guys and gals.  My library is now updated and available here:

http://github.com/roaminggamer/RGEasyTextField/