object.hasBackground

Type Boolean
Object TextField
Library native.*
Revision Release 2024.3703
Keywords text input, text box, native text
See also native.newTextBox()
native.newTextField()

Overview

Controls whether the text box has an opaque background or not. Default is true (opaque).

Gotchas

This property is not supported in Win32 desktop apps or in the Corona Simulator for Windows.

Example

-- Draw red background
local rect = display.newRect( 0, 0, 320, 480 )
rect:setFillColor( 1, 0, 0 )

-- Text field with transparent background
local textField = native.newTextField( 30, 140, 260, 100 )
textField:setTextColor( 0.8, 0.8, 0.8 )
textField.hasBackground = false
textField.text = "Hello, world!"