Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
InputKeyboard - A virtual keyboard in LUA — Gideros Forum

InputKeyboard - A virtual keyboard in LUA

mathzmathz Member
edited August 2012 in Code snippets
After a couple of days hard working I've finally finished something that with you guys: an inputfield that opens a virtual keybord when pressing it.

Hopefully someones finds it usefull.

Please tell me about bugs/improvements (also read info in InputKeyboard.lua)

Please note that it's written for "fit width" and that it only works in portrait mode.

Latest version always found at: https://github.com/mathz/InputKeyboard
InputKeyboard_screenshots.png
1000 x 822 - 66K
Tagged:
+1 -1 (+4 / -0 )Share on Facebook

Comments

  • gorkemgorkem Maintainer
    Simply wonderful. =P~ When you said "couple of days of hardworking", I didnt realize what you meant. :-/

    Do you mind putting this in Github, so others can also benefit from it? Once you do that, I'll add your link to our dev FAQ so it'll (hopefully) be widespread.
  • mathzmathz Member
    Thank you! :)
    Excuse my somewhat confusing text. I got so excited when i pulled this off that I wrote a little bit to fast :P
    It should be more something like "After working hard a couple of days I've finally got something that I would like to share with you guys" :)

    I'll put it on GitHub ASAP, could take some time tough, since I've never used GitHub before.
  • mathzmathz Member
    Update: New version uses truetype font for all keys instead of images.
    This dramatically decreases total file size and also easier to make internationalizations of the keyboard.

    Likes: talis

    +1 -1 (+1 / -0 )Share on Facebook
  • cool.

    nice lib!

    congratz.!
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • mathzmathz Member
    Thanx!

    Hopefully someone will find a use for it.

    Next version will contain some sort of rudimentary localization routine.
  • @mathz thanks for the great lib. And conrtrazt agin for the second update which is using ttf . When i first open your project i was thinking how can i convert it to russian then saw the images and i was dreaming of the hard work.
    Now with ttf it becomes all programmatic. I am not a good designer so loved the second update.
    Thanks again.
  • mathzmathz Member
    You're welcome @talis!

    I got nightmares from all that hours I spent making those images for all resolutions as perfect as possible so I'm happy that you dont have to go through that also :)

    I dont know if the included font (arial) contains cyrillic letters. If not you have to change font and that means two things:
    1. You might need to change the fontsize
    2 I've edited the font to contain the "icons" uppercase,lowercase,delete and enter. You must do the same in whatever font you use.

    I'm currently working on making some localization - primarily the possiblity to change keyboard layout to fit different locales.

    At the moment I'm developing an app which will use this keyboard.
    The app itself could have a quite big potential for success in Russia, therefore i would greatly appreciate if you share any changes you do to make the keyboard work in russian.
  • New version uploaded.
    Localization feature added. Example keyboards in english, german, swedish and for @talis also russian included.
    It's also possible to change keyboard layout during runtime.
    List of changes: https://github.com/mathz/InputKeyboard/wiki/History

    @gorkem: Thankyou for adding the github link to the dev FAQ!
  • @mathz that one really fast :D
    Thanks again you saved me from really lots of hard work.
    =D>
  • No problem @talis!

    Another version online.
    The biggest changes:
    1. Alternative characters when pressing a key for a longer time (for example: press "e" and you can choose "é")
    2. Auto delete more characters when holding "DEL"-key.

    No new updates will be done for a while if no specific bugs shows up, I need to concentrate on other parts of my app :)

    Likes: talis

    +1 -1 (+1 / -0 )Share on Facebook
  • loves_oiloves_oi Member
    edited August 2012
    I downloaded and ran it but how can i change the keyboard for ex. from english to german. Or in order to write a text in a german language , should i find the necessary key and press for long time?
    Thanks in advance
  • New version uploaded.
    Localization feature added. Example keyboards in english, german, swedish and for @talis also russian included.
    It's also possible to change keyboard layout during runtime.
    List of changes: https://github.com/mathz/InputKeyboard/wiki/History

    @gorkem: Thankyou for adding the github link to the dev FAQ!
    Sorry for my stupid question , @mathz . You said that Localization feature added.What is it exactly?
    Thanks in advance
  • Either change
    local keyboard = KeyBoard.new("en_GB")
    to
    local keyboard = KeyBoard.new("de_DE")

    or if you want to change the keyboard on an event use:
    keyboard setLang("de_DE", true)

    Current support keyboards are
    "sv_SE" (swedish)
    "de_DE" (german)
    "en_GB" (british english)
    "ru_RU" (russian)

    It is however fairly easy to change and/or add keyboards. Just look at the current keyboard files in the "locale"-directory - that will give you an idea how to create your own keyboard or if you want to change an existing one.
  • @loves_oi : Es ist nicht eine blöde Frage.
    Mann kan "tastatur-sprache" wechseln :)

    Es gibt ein kleine erklärung in InputKeyboard.lua wie alles funktioniert, aber in moment habe leider keine zeit eine genauer dokumentation zum machen.

    Hopefully that's understandable, my german is not as good as it should be :(
  • Also... if you find any bugs or other strange things, please let me know. This is my first real attempt at gideros and lua so don't expect it to be perfect.
  • loves_oiloves_oi Member
    edited August 2012
    No no no . i gave an example ,German. I dont know German:)
    i didn't undertand it :(
    If it is your first real attempt , you are really wonderful.
  • loves_oiloves_oi Member
    edited August 2012
    No no no . i gave an example @mathz ,German. I dont know German:)
    i didn't undertand it :(
    If it is your first real attempt , you are really wonderful.
  • @loves_oi : sorry for not answering, I've been away for some time.

    I only wrote that your question is not stupid! and that the localization feature means that it is possible to change to different keyboard layouts depending on the users localization.
    For example, a swedish person (like myself) would probably prefer a swedish keyboard layout and a russian would prefer a russian layout.

    I also wrote that there is a small explanation inside the file InputKeyboard.lua about how it works.

    And yes, it is my real first attempt to make something more advanced in lua/gideros, so thank you for your kind words :)
  • @mathz
    Thanks for sharing!
    You could also add a few screenshots in your original post to boost the downloads and get more feedback.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • @mathz, you could also try to use the locale to set the default keyboard rather than set a en_GB to start with.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @mells : thank you for the suggestion!

    @OZApps : You are correct, that is better. I've uploaded a new version to github now, thank you!
  • @mathz , i'm using your code , but i didn't understand one point . You have a folder named 'img' . For what reason and where do you use it? In my code , size of objects looks bigger than normal in the screen. I want to fix it , i want it looks in normal size. I think that it is related to the img folder. But in main.lua i can't see any line which uses img folder. What should i do in order to solve this size problem ? I have a related question at this link :
    http://www.giderosmobile.com/forum/discussion/1758/attempt-to-index-global-039scenemanager039-a-nil-value-problem#Item_5
    Thanks in advance.
  • Hi @loves_oi,
    The img-folder contains all images realted to the keyboard in different resolutions.
    All in all there are 6 images per resolution.
    These are used in the KeyBoard.lua file, not the main.lua file.

    The InputKeyboard uses 480x800 as the base-resolution. Therefore it is adviced that your app also uses that. However you can use another resolution, but then you have to adjust the image scales properties accordingly.

    Please make sure that all images exists in your img-folder and that the project properties contains all image scales you want to you (these are present in my project on github).

    If you still have problems after this, please send me your entire project and I'll have a look at it.
  • Hi @mathz,
    I downloaded Inputkeyboard and found very useful and it works great on portrait mode..
    Thanks a lot for sharing...

    Have you found any solution, to work it in Landscape mode...
    I'm developing a project which is in Landscape mode, but I want to implement your's Inputkeyboard in my project, as it fills my requirements...

    Any new release which supports landscape mode?

    Thank you... :) :-? :)
  • Hi @Sush19
    Thankyou for using my keyboard :)
    I have unfortunately abandoned Gideros since I got tired of having to invent the wheel over and over again (for example having to do something as fundamental as a keyboard).
    I took a quick look at my old code and what you could do to get started is on lines 523-534, 653-659 changing all occurrences of
    getLogicalHeight to getLogicalWidth
    getLogicalTranslateY to getLogicalTranslateX
    getLogicalScaleY to getLogicalScaleX
    getLogicalWidth to getLogicalHeight

    This will make it possible to use i landscape mode, BUT more changes have to be done to make it also look good.
    Hopefully this is enought to get you started :)
  • Hello @mathz
    Thank you for your reply...
    I'll do the changes and try it to work in landscape mode...

    Will let you know my progress after giving a try to it...

    Thank you so much... :) :)
  • Hi @mathz,

    I've made those changes, and it works....
    As you told more changes have to be done to make it look good... Will try for that, Right now For my project I just wanted number keyboard, from "0-9" with a "." and a "backspace", I'll try to create it by referring your code... Please help me out with your suggestion, to build this simple number keyboard which must works with inputbox.. I'm new to lua...

    Thank you.. :)
Sign In or Register to comment.