This shows you the differences between two versions of the page.
built_in:text [2015/09/27 13:24] stevegarman add AutoScale option |
built_in:text [2019/06/22 01:01] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Text control ====== | ||
- | |||
- | // | ||
- | |||
- | ===== Description ===== | ||
- | Create Text objects using the **CreateText** method of the **[[app]]** object: | ||
- | < | ||
- | You can use the **" | ||
- | |||
- | Use the **SetText** and **GetText** functions of the Text object to set and get it's text. | ||
- | |||
- | ==== Example - Single line ==== | ||
- | <code javascript> | ||
- | function OnStart() | ||
- | { | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | txt = app.CreateText( " | ||
- | txt.SetTextSize( 22 ); | ||
- | lay.AddChild( txt ); | ||
- | |||
- | app.AddLayout( lay ); | ||
- | } | ||
- | </ | ||
- | You can change the look of a Text using the **SetBackColor** and **SetTextColor** functions on the Text object. | ||
- | |||
- | ==== Example - Multi line ==== | ||
- | <code javascript> | ||
- | function OnStart() | ||
- | { | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | txt = app.CreateText( " | ||
- | txt.SetTextSize( 12 ); | ||
- | txt.SetTextColor( "# | ||
- | txt.SetBackColor( "# | ||
- | lay.AddChild( txt ); | ||
- | |||
- | app.AddLayout( lay ); | ||
- | } | ||
- | </ | ||
- | You can also set a background image/ | ||
- | |||
- | ===== Methods ===== | ||
- | Some controls use the same methods.\\ | ||
- | For examples of the **[[same methods]]** look here. | ||
- | ^ Method | ||
- | | Text.Destroy() | ||
- | | Text.GetAbsHeight() | ||
- | | Text.GetAbsWidth() | ||
- | | Text.GetHeight() | ||
- | | Text.GetLineCount() | ||
- | | Text.GetLineStart( line ) | | | ||
- | | Text.GetLineTop( line ) | | | ||
- | | Text.GetMaxLines() | ||
- | | Text.GetPosition() | ||
- | | Text.GetText() | ||
- | | Text.GetTextSize( mode ) | ||
- | | [[built_in: | ||
- | | Text.GetVisibility() | ||
- | | Text.GetWidth() | ||
- | | Text.Release() | ||
- | | Text.SetBackColor( color ) | ||
- | | Text.SetBackGradient( color1, | ||
- | | Text.SetBackGradientRadial( x, | ||
- | | Text.SetBackground( imagefile, | ||
- | | Text.SetEllipsize( mode ) | Shorten long text with " | ||
- | | Text.SetFontFile( file ) | ||
- | | Text.SetHtml( html ) | ||
- | | Text.SetMargins( left, | ||
- | | Text.SetOnLongTouch( callback ) | | | ||
- | | Text.SetOnTouch( callback ) | | | ||
- | | Text.SetOnTouchDown( callback ) | | | ||
- | | Text.SetOnTouchMove( callback ) | | | ||
- | | Text.SetOnTouchUp( callback ) | | | ||
- | | Text.SetPadding( left, | ||
- | | Text.SetPosition( left, | ||
- | | Text.SetScale( x,y ) | ||
- | | Text.SetSize( width, | ||
- | | Text.SetText( text ) | ||
- | | Text.SetTextColor( color ) | ||
- | | Text.SetTextShadow( radius, | ||
- | | Text.SetTextSize( size,mode ) | | | ||
- | | Text.SetTouchable( touchable ) | ||
- | | Text.SetVisibility( HideShow ) | ||
- | |||
- | ===== Options ===== | ||
- | |||
- | ^ Option | ||
- | | AutoScale | ||
- | | Bold | Write bold Text | | ||
- | | FontAwesome | ||
- | | Html | ||
- | | Left | ||
- | | Multiline | ||
- | | Right | | | ||