Class Widget.Text

Text Widget Module.

displays text content. this widget wraps the a Corona OpenGL Text component to provide its core functionality.

Inherits from:
* Core.Widget

Style Object:
* Style.Text

Usage:

     dUI = require 'dmc_ui'
     widget = dUI.newText()

Properties

.align () [style] set/get align.
.fillColor () [style] set/get Style value for Widget fill color.
.font () [style] set/get font.
.fontSize () [style] set/get fontSize.
.marginX () [style] set/get marginX.
.strokeWidth () [style] set/get strokeWidth.
.textColor () [style] set/get textColor.
.width () [style] set/get width.
.height () [style] set/get height.
.text () set/get widget text.

Methods

:getTextHeight () get height of Corona Text object.
:setFillColor () set the fill color of the simple background.
:setStrokeColor () set stroke color of the simple background.
:setTextColor () set color of text.

Class Constants

Widget.Text.LEFT Constant for 'left'
Widget.Text.CENTER Constant for 'center'
Widget.Text.RIGHT Constant for 'right'


Properties

.align ()
[style] set/get align. values are 'left', 'center', 'right'

Usage:

  • widget.align = 'center'
  • print( widget.align )
.fillColor ()
[style] set/get Style value for Widget fill color.

Usage:

  • style.fillColor = '#ff0000'
  • print( style.fillColor )
.font ()
[style] set/get font. can either be Corona font (eg, native.systemFont) or one installed in system (eg, 'Helvetica-Grande')

Usage:

  • widget.font = native.systemFont
  • print( widget.font )
.fontSize ()
[style] set/get fontSize. set the font size of the text.

Usage:

  • widget.fontSize = 18
  • print( widget.fontSize )
.marginX ()
[style] set/get marginX. set the margin inset of the widget. this value is subtracted from the widget width.

Usage:

  • widget.marginX = 18
  • print( widget.marginX )
.strokeWidth ()
[style] set/get strokeWidth. set stroke width for the simple background.

Usage:

  • widget.strokeWidth = 18
  • print( widget.strokeWidth )
.textColor ()
[style] set/get textColor. set the font size of the text.

Usage:

  • widget.textColor = 18
  • print( widget.textColor )
.width ()
[style] set/get width. Note: this property changes both the width of the DMC Text Widget and the encapsulated Corona Text widget. If the style is unset, then the width value is the width of the encapsulated Corona Text widget. If the style value is set, then then the width for both will change to that value.

Usage:

  • widget.width = 5
  • print( widget.width )
.height ()
[style] set/get height. Note: this property doesn't change the height of the actual Corona Text widget, that remains constant. If the style is unset, then the height value is the height of the encapsulated Corona Text widget. If the style value is set, then then the height is that value, even if the height of the Corona Text widget is different. (If the height of the Corona Text widget is set then it becomes a multi-line text widget.)

Usage:

  • widget.height = 5
  • print( widget.height )
.text ()
set/get widget text.

Usage:

  • widget.text = 5
  • print( widget.text )

Methods

:getTextHeight ()
get height of Corona Text object. return the height of the encapsulated Corona text object, not height of the DMC Text Widget. returns 0 if Corona Text has yet to be created.

Returns:

    number height of Corona Text object

Usage:

    print( widget:getTextHeight() )
:setFillColor ()
set the fill color of the simple background.

Usage:

     widget:setFillColor( grey )
     widget:setFillColor( grey, a )
     widget:setFillColor( r, g, b, a )
     widget:setFillColor( gradient )
:setStrokeColor ()
set stroke color of the simple background.

Usage:

     widget:setStrokeColor( grey )
     widget:setStrokeColor( grey, a )
     widget:setStrokeColor( r, g, b, a )
     widget:setStrokeColor( gradient )
:setTextColor ()
set color of text.

Usage:

     widget:setTextColor( grey )
     widget:setTextColor( grey, a )
     widget:setTextColor( r, g, b, a )
     widget:setTextColor( gradient )

Class Constants

Widget.Text.LEFT
Constant for 'left'
Widget.Text.CENTER
Constant for 'center'
Widget.Text.RIGHT
Constant for 'right'
generated by LDoc 1.4.3 Last updated 2015-05-14 11:55:05