Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

getting focus/blinker out of a native.newTextField
Started by edualc Jan 28 2019 03:31 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 72 posts
  • Corona SDK

Hi all,

i'm using a native.newTextField to get the name of the user (if he/she wants to enter it). After it's been entered, I'd also like to uppercase the first character (e.g. george -> George) 

But .. the cursor/blinker stays on the field even if I click on other buttons, anywhere on the screen etc..

Only if I click on another window (e.g. clicking on a Chrome window when using the simulator) that it disappears and apply the Uppercase feature.

I've tried heaps of things but no luck. At some stage i thought maybe it's a simulator thing, but nope, my samsung tablet has the same problem.

when I go into another screen then I receive "George" rather than "george" but i would like to see it straight away in the menu and also I would like the cursor to stop blinking into the field.

help !

-- currentUser field
function lncurrentUser(event)
print ("lncurrentUser",event.phase)
    if ( event.phase == "began" and currentUser.text == "Enter Your Name") then
            currentUser.text = " "
            print "cleared currentUser.text"
--        event.target.isFocus = true

    elseif ( event.phase == "ended" or event.phase == "submitted" ) then
          currentUser.text = string.upper(string.sub(currentUser.text,1,1))..string.sub(currentUser.text,2,string.len(currentUser.text))
--        event.target.text = string.upper(string.sub(currentUser.text,1,1))..string.sub(currentUser.text,2,string.len(currentUser.text))
          print ("finished currentUser.text",currentUser.text)
--        sceneGroup:insert(currentUser);
--        event.target.isFocus = false
--        currentUser.isFocus = false
--        btn_play.isFocus = true
--        currentUser.alpha = 0 ; currentUser.alpha = 1
--        native.setKeyboardFocus( nil )

    end

 



[TOPIC: post.html]
#2

edualc

[GLOBAL: userInfoPane.html]
edualc
  • Enthusiast

  • 72 posts
  • Corona SDK

my apologies, on the device (android - galaxy tab + notes 8) the cursor/blinker DOES go away ! (not on the simulator)

 

It leaves the question about how can I refresh/re-display the field so it shows George while still in the menu ?




[topic_controls]
[/topic_controls]