textField.isSecure ends event

Hi, I’m supposed to make a native textfield that has a placeholder for the password.
Unfortunately, when I set isSecure, it ends the event. Is this a bug?

Here’s a sample of my code

[code]
local function textfieldListener(event)
if event.phase == “begin” then
print(“begin”);

elseif event.phase == “end” then

end
end

passwordTxtField = native.newTextField(255, 300, 550, 55);
passwordTxtField:addEventListener(“userInput”, textfieldListener);

[/code] [import]uid: 91271 topic_id: 31627 reply_id: 331627[/import]

I’m sorry, I dont know what happened, but here’s the complete and correct sample of my code:

local function textfieldListener(event)  
 if event.phase == "began" then  
 print("began");  
 passwordTxtField.isSecure = true;  
 elseif event.phase == "ended" then  
 print("ended");  
 end  
end  
   
passwordTxtField = native.newTextField(255, 300, 550, 55);  
passwordTxtField:addEventListener("userInput", textfieldListener);  

On the terminal:

began  
ended  

It ended even I was still about to type! Now I can’t input anything. [import]uid: 91271 topic_id: 31627 reply_id: 126329[/import]

Don’t try to change the secure type like that. It’s not guaranteed to work. On some platforms, secure textfields are completely different object types and implementations (you want it to be secure so it needs special backends). Changing the property like that may require the old textfield to be completely destroyed and a new secure one to be created. Losing focus would be an obvious side effect of that.
[import]uid: 7563 topic_id: 31627 reply_id: 126390[/import]

oh well, that’s a little bit disappointing especially that we still have to make a workaround just to have a placeholder in textfields. it seems adding a placeholder to a password textfield is more work than what it’s supposed to be. :frowning: [import]uid: 91271 topic_id: 31627 reply_id: 126452[/import]

Placeholder text is available in iOS and Mac.
[import]uid: 7563 topic_id: 31627 reply_id: 126459[/import]

really? how do i do it? can’t see it on the documentation [import]uid: 91271 topic_id: 31627 reply_id: 126487[/import]

I’m sorry, I dont know what happened, but here’s the complete and correct sample of my code:

local function textfieldListener(event)  
 if event.phase == "began" then  
 print("began");  
 passwordTxtField.isSecure = true;  
 elseif event.phase == "ended" then  
 print("ended");  
 end  
end  
   
passwordTxtField = native.newTextField(255, 300, 550, 55);  
passwordTxtField:addEventListener("userInput", textfieldListener);  

On the terminal:

began  
ended  

It ended even I was still about to type! Now I can’t input anything. [import]uid: 91271 topic_id: 31627 reply_id: 126329[/import]

Don’t try to change the secure type like that. It’s not guaranteed to work. On some platforms, secure textfields are completely different object types and implementations (you want it to be secure so it needs special backends). Changing the property like that may require the old textfield to be completely destroyed and a new secure one to be created. Losing focus would be an obvious side effect of that.
[import]uid: 7563 topic_id: 31627 reply_id: 126390[/import]

oh well, that’s a little bit disappointing especially that we still have to make a workaround just to have a placeholder in textfields. it seems adding a placeholder to a password textfield is more work than what it’s supposed to be. :frowning: [import]uid: 91271 topic_id: 31627 reply_id: 126452[/import]

Placeholder text is available in iOS and Mac.
[import]uid: 7563 topic_id: 31627 reply_id: 126459[/import]

really? how do i do it? can’t see it on the documentation [import]uid: 91271 topic_id: 31627 reply_id: 126487[/import]