Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Improved text fields feature request
Started by jaime9 Nov 29 2018 01:40 AM

5 replies to this topic
win32 keyboard input textfield native
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jaime9

[GLOBAL: userInfoPane.html]
jaime9
  • Enthusiast

  • 48 posts
  • Corona SDK

Hello, I just posted a feature request for improved text fields in Win32.

 

Go and vote for it: http://feedback.coronalabs.com/forums/188732-corona-feature-requests-feedback/suggestions/36137746-proper-text-field-for-win32

 

This is what I miss the most from Win32 Corona.

 

Thanks!



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,997 posts
  • Corona SDK

Hi @jaime9. Obviouslly win32 based apps have pretty flexible text input fields, but those text fields are not designed to work with OpenGL. It took some pretty creative programming techniques to get what we have. I'll let engineering know about this request, but I don't know how much we can do given the complexity involved.

 

Rob



[TOPIC: post.html]
#3

jaime9

[GLOBAL: userInfoPane.html]
jaime9
  • Enthusiast

  • 48 posts
  • Corona SDK

I absolutely understand, Rob. I *think* a transparent background and removing the frame would be enough so they are totally usable.

 

Alternatively a win32 function to translate the native keycode to ASCII / Unicode would help a lot in making a custom, lua based solution.

 

Thank you, as usual!



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 368 posts
  • Corona SDK

I actually made such a function for a client some time ago where if the user clicked on a text field, which was really just a simple image rect in this case, the app started to listen for event.keyNames. As the user inputted keys, I simply added them to the string and updated the text display object.

In addition to that, I only needed to add a few other tricks like, if there is already text on the "text field" when the user clicks it, then I used event.x and event.y to calculate where on the string the user clicked and made that the active text input location. Additionally, I needed to write what happens when the user presses enter, delete, backspace, arrow keys, etc.



[TOPIC: post.html]
#5

jaime9

[GLOBAL: userInfoPane.html]
jaime9
  • Enthusiast

  • 48 posts
  • Corona SDK

I have one such thing "half cooked", too... but then I realized (and remembered from old times) that the mapping key - character is not trivial, there are tons of different keyboards out there. That's why I asked, to enable the DIY option, to have a key code to ASCII / Unicode.



[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 368 posts
  • Corona SDK

Absolutely. My solution isn't universal by any means. My code works as I knew that my client would only use it with Nordic keyboards.

Edit: Oh, right. You can get some degree of ASCII codes by using event.nativeKeyKode. I'm using the phrase "some degree", as 1 key returns 49, 2 returns 50, etc. but the keys for a, b, c, etc. return 65, 66 and 67, etc. which belong to A, B, C, etc. but you can get around them.




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: win32, keyboard, input, textfield, native