native.newTextBox - border missing ?

I was wondering, when I use native.newTextField it produces a border around the field, but when I use native.newTextBox, it doesn’t produce any border around the box?

Is this normal? And is there a way to add a border, with it not being a regular display object.

Also the placeholder is missing?

The whole thing simply appears as a white box with no border around it

I’m using corona 2014.8.5 on both Windows and Mac (I realise Mac simulator is best for previewing native textFields and Boxes)

I built the app for my ios6 iphone 4s and it looks the same as it does in the simulator - a white box with no border (see attached image)

The code:

from_textBox = native.newTextBox( display.contentWidth * 0.5, 150, 290 ,110)

from_textBox.font = native.newFont( native.systemFont, 16 )

from_textBox.isEditable = true

from_textBox.placeholder = “From Address”

from_textBox.hasBackground = true

its pretty normal to enable the border try this

It works to me it’s strange why I have to do this

from\_textBox = native.newTextBox( display.contentWidth \* 0.5, 150, 290 ,110) from\_textBox.isSecure = true from\_textBox.isSecure = false 

a border will appear, strange but works for me

thank you, i’ll give it a go

I keep coming back to Corona and giving it another chance, but each time I come across sill obstacles like this.

UPDATE:

Tried your suggestion and it removed the background, so only text appears

UPDATE:

Removed the background false code I’d forgotten I’d added in desperation.

Tested again and no difference to my original white box without outline or placeholder

It looks like that object does not have an internal way to set a border around it.

Rob

For what it’s worth, on device, even native.newTextField doesn’t have a border.  It’s just a white rounded rect behind the text.  What you’re seeing in the simulator is a feature of OS-X text fields.

Rob

Rob, do you know why native.newTextField permits a placeholder, yet newTextBox doesn’t?

Incidentally, I’ve made both textBox and textField transparent, an am applying my own background box to them. Just wondering if I need to implement a placeholder based on the event phase of the texBox - the Corona docs certainly mention a placeholder? ( http://docs.coronalabs.com/api/type/TextBox/placeholder.html )

Can you post your newTextBox constructor code?

Rob

from_textBox = native.newTextBox( halfW, y_pos, 290 , 100)

from_textBox.isEditable = true

from_textBox.placeholder = “From Address”

Are you initializing the .text property to “” anywhere?

no, but I can give it a try?

UPDATE: No difference

The Windows simulator shows no placeholder / hints anywhere for either textFields or TextBoxes

The Mac simulator shows placeholder /.hints for textFields, but doesn’t show anything for TextBoxes

The Mac simulator shows a weird graphical anomaly with a type of inner dropshadow for TextBoxes

Here’s what I see on the Mac Simulator (apologies for quality)

photo.jpg

Mac and PC simulators are both 2014.2393

The native.text* API’s do not work in Windows.  It is not possible because of the way Windows doesn’t integrate OpenGL and their native objects.  I don’t know where the frame is coming from.  If you run the sample app NativeDisplayObjects, you should see just a white box on the wood background. 

The reason I was asking if you were setting the .text property to “” was that might kill the placeholder since there is actually something there.

This looks like it might be a bug, if it’s really supposed to be supported.  Can you file a bug report  using the “Report  a bug” link at the top of the page.   You pretty much could take the NativeDisplayObjects sample app and try to set a place holder on the text box and submit that whole project.

You will get an email back from the bug tracker with a bug ID #.    Please post that bug number back here when you get it.

Rob

Ok, will do Rob.

I checked the sample native objects app, that comes with Corona and I can confirm it looks like a bug - I ran it on the Mac Simulator. On the sample app, it allows you to display a native.textBox, which has been set with lots of text, deliberately to show the horiz and vert scroll ability. The “anomaly” I mention in the above image looks like it’s used by the scroll bars.

Trouible is, when edit the sample text and remove it all, this anomaly stays in the background.

So the sample app appears to display the same bug. Can you confirm this? Empty the text from the sample text box and see if that background anomaly remains. 

Perhaps this contributes to why the textBox placeholder doesn’t work - perhaps it’s being obscured by this anomaly?

I don’t see this anomaly with no text in the box.

Rob

Ah, so that could be a bug in the VMWare OpenGL driver at my end.

Can you see a placeholder when you create a textBox ? I can’t

I believe the placeholder not showing is either a bug, or it’s not supported and the documentation needs to be updated to reflect if it supports it or not.

Now as far as the VMware issue goes, we do not support Corona SDK running under virtual machines.  So if you’re seeing display anomalies, then there isn’t going to be much we do for that.

Rob

Ok, we’ll put the image anomaly down to my VMWare Workstation (10.0.3), as you don’t see it on your proper Mac (proper as in not a VM like mine)

As for the placeholder not appearing, do you need me to file a bug report?

Really, for continuity, the textBox should behave the same as the textField - both having placeholders and option for background/outline.

In the meantime, I’ve implemented my own textBox placeholder code - simply listening for the edit event and toggling the isVisible component of a text display object, when the string length = 0

Yes, please file a bug report about the placeholder missing.  Take the existing NativeDisplayObjects sample app, modify the textBox to have a place holder and use that as the required project to submit.  Focus only on the placeholder issue when filing it.  You will get an email with a bug ID # in it.  Please post that number back here as a reference.  Please use zip to compress the package and not some other format like RAR.

Now as far as the frame/outline/background.  On device the background handling is consistent.  You get a borderless box as a background.  For the textBox it’s a white rectangle.  For the textField is a white rounded rectangle (at least on iOS 7).  Turning the background off hides both.   Where you see an outline is on the simulator for the Mac.  The OS-X textField shows a glowing bluish outline around the selected field, and not around the unselected fields.  iOS does not behave this way.  Because the simulator isn’t the end goal, the device is, this is not something engineering would likely address. 

Rob

its pretty normal to enable the border try this

It works to me it’s strange why I have to do this

from\_textBox = native.newTextBox( display.contentWidth \* 0.5, 150, 290 ,110) from\_textBox.isSecure = true from\_textBox.isSecure = false 

a border will appear, strange but works for me