Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Native Text Fields? — Gideros Forum

Native Text Fields?

ljp1203ljp1203 Member
edited October 2012 in General questions
Hi all!

I need some help. I need to put text boxes into my app to allow users to enter info.

What would be the code to do this?

Thanks!
-Landon

Likes: averticalworld

Dislikes: edopenroz, johnyc100

JLS
Lead Coder and Designer
+1 -1 (+1 / -2 )Share on Facebook

Comments

  • Well if you want to use native TextFields, you would have to create plugins for all platforms you would want to support.

    Other option would be to create a button with text "set username" and then open TextInputDialog on click, where user could enter username, then you can store this input in a variable and use where ever you want.

    Example would be:
    local currentUsername = ""
    local text = TextField.new(nil, "Set your username")
    local setUsernameBtn = Button.new(text, text)
    setUsernameBtn:addEventListener("click", function()
          local textInputDialog = TextInputDialog.new("Set Your Username", "Input your username here", "unknown", "Cancel", "OK")
     
        local function onComplete(event)
            if event.buttonIndex then
                currentUsername =  event.text
            end
        end
     
        textInputDialog:addEventListener(Event.COMPLETE, onComplete)
        textInputDialog:show()
    end)
    --currentUsername now contains input username
  • bowerandybowerandy Guru
    edited October 2012 Accepted Answer
    @ljp1203, Gideros doesn't support a native text field that is portable across platforms. @ar2rsawseen's suggestion is the closest you can come right now. However, if you are on iOS only then you can use my Hot Wax plugin and add in whatever native fields that you like. See Hot Wax on my blog. And also this video:



    Obviously, you don't have to to the physics stuff if you don't need it.

    best regards

  • Hi @bowerandy,

    I followed you tutorial on YouTube, but I keep getting build failed, and I can't seem to find the cause. I followed the tutorial exactly.

    Thanks!
    -Landon
    JLS
    Lead Coder and Designer
  • @ljp1203, did you add the UIKit and other things while building the Gideros player? It has to be then run on the device or the xcode simulator, it will not work on the Gideros Desktop Player.

    If you would share how it failed i.e. what the error message was, you could get some help in fixing it.
    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
  • Hi @OZApps,

    I've attached screenshots with the files I've added, and also the errors i am getting. Thanks and hopefully you can help me with this! :)

    Thanks!
    -Landon
    Screen Shot 2012-10-15 at 8.50.29 PM.png
    1138 x 782 - 225K
    Screen Shot 2012-10-15 at 8.51.36 PM.png
    1138 x 782 - 203K
    JLS
    Lead Coder and Designer
  • @ljp1203, did you make sure that the GiderosIOSPlayer target was checked when you added the files to the XCode project? Go through each of the .m files and check this:

    https://dl.dropbox.com/u/2242074/2012-10-16_09-06-28.png

    best regards
  • ljp1203ljp1203 Member
    edited October 2012
    Hi! @bowerandy @OZApps

    Thanks for the replies!

    Now I have another question. I have developed my app to the point of where I will start to need Plugins such as Wax or UIKit. How would I implement these into my existing project? Do I have to export the project?

    If you can, can you give me step by step directions because I am still new to the Plugins part of Gideros :)

    Thanks!
    -Landon
    JLS
    Lead Coder and Designer
Sign In or Register to comment.