object.size

Type Number
Object TextBox
Library native.*
Revision Release 2024.3703
Keywords text size, native text input
See also native.newTextBox()

Overview

Gets or sets the native text box's font size.

Setting this property to nil or 0 will make the text box use the system's default font size.

Gotchas

The font size read or written to this property may be either in Corona's content-scaled points or the platform's native points. You can determine which font size units are currently being used by querying the text box's object.isFontSizeScaled property.

By default, the font size is measured in Corona's content-scaled point system, just like display.newText(), but the default can be changed via the "isNativeTextBoxFontSizeScaled" key of display.setDefault().

Example

-- Create a native text box
local textBox = native.newTextBox( 160, 240, 280, 140 )
textBox:setTextColor( 0.8, 0.8, 0.8 )
textBox.hasBackground = false
textBox.text = "Hello World!"

-- Change the text box's size property
textBox.size = 18