changing cursor color on native.newTextField()

Hi. Is it possible to change cursor color while typing inside a native.newTextField()? I’m talking about that blinking cursor “|” not the actual text.

Regards,

Carlos.

Hi Carlos,

No it is not, sorry

The best way to deal with this is to mirror text input from the native textfield to a newtext object.

Then you can format it much better

Anaqim

Thanks for the reply anaqim. hope corona changes that. this should not be a requested feature in my book but a basic built-in feature that was “forgot” or not though. if I change color text it will change the cursor, so this can be done, but we should be able to change them independently if we want. I’m doing all basic objects with material design guidelines, and in their guide, the cursor has different color than the text. textfield on corona is already complex and well done, I can format for whatever I want already with what corona provide, it only misses the cursor. mimic to a newtext object is not the way to go. there are lot’s of things you can’t mimic easy and you need to reinvent the wheel, like a placeholder, password type, etc. it’s very easy using those things on textfield and should be used since it’s already provided. it just needs to be polished for all ;).

I had a similar opinion about this like you have, but after receiving an extensive explanation about the challenges using OpenGL, I understand there is a lot more to this than I assumed.

Conclusion, its very costly to implement in terms of work hours due to the complexity involved across devices and OS’s.

It won’t happen, but there is a workaround, and it’s quite easy to do but if you want an easy go-to one-liner solution, I know Jason Schroeder is working on a solution that will pop up in markedplace soon. From what he wrote, it is based on the same concept of mirroring, but of course he has to make sure it works everywhere. My app where i use it only need to work on mac and win32.

Cheers!

good to know people are contribution with better/different solutions than corona provide.

I thought it would be easy to change the color of the cursor. they are already doing it.

looking around on google, on IOS seems pretty easy to change it:

textField.tintColor = [UIColor redColor];

for all app:

[[UITextField appearance] setTintColor:[UIColor redColor]];

on android looks pretty easy also:

https://android–code.blogspot.pt/2015/08/android-edittext-cursor-color.html

btw, mac simulator still have a bug regarding event.oldText not working at all, returns nil. on iphone,  windows and android device works.

but its kinda frustrating, since I reported this bug months ago still no correction. If I need to install all the time, my test apps on a real device, it defeats the propose of a simulator. 

you can check the bug with corona example:

local defaultField local function textListener( event ) if ( event.phase == "began" ) then -- User begins editing "defaultField" elseif ( event.phase == "ended" or event.phase == "submitted" ) then -- Output resulting text from "defaultField" print( event.target.text ) elseif ( event.phase == "editing" ) then print( event.newCharacters ) print( event.oldText ) print( event.startPosition ) print( event.text ) end end -- Create text field defaultField = native.newTextField( 150, 150, 180, 30 ) defaultField:addEventListener( "userInput", textListener )

@carloscosta, do you have the case ID on the bug report?

As far as we would never fix this or add it, that’s simply not true. Are we going to build an OpenGL text field? No. We simply don’t have the resources to tackle something that complex. However adding features to our existing native text functions, if they are within reason are not out of the question. We have limited bandwidth on what to work on and even something like adding a .tintColor property is rarely as easy as adding one line of code. 

We also have to look at what you’re requesting that we add, what we have stated we are going to work on and other factors to figure out our engineering priorities. I can say this though if we don’t have a feedback request item (http://feedback.coronalabs.com), then we have no way of tracking that anyone wants this feature.

Rob

@Rob,

I didn’t found the bug report case, (found other 2 bug report! {8717420} bug report {8488245}) but reading my old emails, I realized that in this last 2 reports (April) I had to send by email, because I tried the normal link and you said you never received them. guess some older bug reports never got to you since I never posted here in the forum, I just went to bug report form and applied it. i remember also that i’ve made more than that bug report but like in this case i just move along since i can’t wait for bugs beeing corrected, and resolved like i could. in this case (event.oldText) i just used string.sub to substitute the event.oldText that did not work on mac.

the rest of your post i don’t have a clue what’s your talking about. never said anything about building openGL text field.

my question was if it is possible or not to change the cursor color. anaqim responded to that. rest of the conversation was other solutions and crying about how easy or not to make that change.

if I wanted to corona implement this feature I know I had to go to feedback…wait a year or more, wait for other people beeing interested of that change. since I know this request is not a big deal and probably no one cares about (usually programmers don’t care about design and they suck hard at it), that way is not going to happen.

I’m already happy with all the hard work Corona team provides. please let me cry about things that they don’t and I wish they did :slight_smile:

Hi Carlos,

No it is not, sorry

The best way to deal with this is to mirror text input from the native textfield to a newtext object.

Then you can format it much better

Anaqim

Thanks for the reply anaqim. hope corona changes that. this should not be a requested feature in my book but a basic built-in feature that was “forgot” or not though. if I change color text it will change the cursor, so this can be done, but we should be able to change them independently if we want. I’m doing all basic objects with material design guidelines, and in their guide, the cursor has different color than the text. textfield on corona is already complex and well done, I can format for whatever I want already with what corona provide, it only misses the cursor. mimic to a newtext object is not the way to go. there are lot’s of things you can’t mimic easy and you need to reinvent the wheel, like a placeholder, password type, etc. it’s very easy using those things on textfield and should be used since it’s already provided. it just needs to be polished for all ;).

I had a similar opinion about this like you have, but after receiving an extensive explanation about the challenges using OpenGL, I understand there is a lot more to this than I assumed.

Conclusion, its very costly to implement in terms of work hours due to the complexity involved across devices and OS’s.

It won’t happen, but there is a workaround, and it’s quite easy to do but if you want an easy go-to one-liner solution, I know Jason Schroeder is working on a solution that will pop up in markedplace soon. From what he wrote, it is based on the same concept of mirroring, but of course he has to make sure it works everywhere. My app where i use it only need to work on mac and win32.

Cheers!

good to know people are contribution with better/different solutions than corona provide.

I thought it would be easy to change the color of the cursor. they are already doing it.

looking around on google, on IOS seems pretty easy to change it:

textField.tintColor = [UIColor redColor];

for all app:

[[UITextField appearance] setTintColor:[UIColor redColor]];

on android looks pretty easy also:

https://android–code.blogspot.pt/2015/08/android-edittext-cursor-color.html

btw, mac simulator still have a bug regarding event.oldText not working at all, returns nil. on iphone,  windows and android device works.

but its kinda frustrating, since I reported this bug months ago still no correction. If I need to install all the time, my test apps on a real device, it defeats the propose of a simulator. 

you can check the bug with corona example:

local defaultField local function textListener( event ) if ( event.phase == "began" ) then -- User begins editing "defaultField" elseif ( event.phase == "ended" or event.phase == "submitted" ) then -- Output resulting text from "defaultField" print( event.target.text ) elseif ( event.phase == "editing" ) then print( event.newCharacters ) print( event.oldText ) print( event.startPosition ) print( event.text ) end end -- Create text field defaultField = native.newTextField( 150, 150, 180, 30 ) defaultField:addEventListener( "userInput", textListener )

@carloscosta, do you have the case ID on the bug report?

As far as we would never fix this or add it, that’s simply not true. Are we going to build an OpenGL text field? No. We simply don’t have the resources to tackle something that complex. However adding features to our existing native text functions, if they are within reason are not out of the question. We have limited bandwidth on what to work on and even something like adding a .tintColor property is rarely as easy as adding one line of code. 

We also have to look at what you’re requesting that we add, what we have stated we are going to work on and other factors to figure out our engineering priorities. I can say this though if we don’t have a feedback request item (http://feedback.coronalabs.com), then we have no way of tracking that anyone wants this feature.

Rob

@Rob,

I didn’t found the bug report case, (found other 2 bug report! {8717420} bug report {8488245}) but reading my old emails, I realized that in this last 2 reports (April) I had to send by email, because I tried the normal link and you said you never received them. guess some older bug reports never got to you since I never posted here in the forum, I just went to bug report form and applied it. i remember also that i’ve made more than that bug report but like in this case i just move along since i can’t wait for bugs beeing corrected, and resolved like i could. in this case (event.oldText) i just used string.sub to substitute the event.oldText that did not work on mac.

the rest of your post i don’t have a clue what’s your talking about. never said anything about building openGL text field.

my question was if it is possible or not to change the cursor color. anaqim responded to that. rest of the conversation was other solutions and crying about how easy or not to make that change.

if I wanted to corona implement this feature I know I had to go to feedback…wait a year or more, wait for other people beeing interested of that change. since I know this request is not a big deal and probably no one cares about (usually programmers don’t care about design and they suck hard at it), that way is not going to happen.

I’m already happy with all the hard work Corona team provides. please let me cry about things that they don’t and I wish they did :slight_smile: