This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
built_in:text [2014/09/17 18:15] stevegarman created |
built_in:text [2019/06/22 01:01] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Text control ====== | ====== 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 ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | Some controls use the same methods.\\ |
- | |txt.GetHeight| | | + | For examples of the **[[same methods]]** look here. |
- | |txt.GetLineCount| | | + | ^ Method |
- | |txt.GetLineStart| | | + | | Text.Destroy() |
- | |txt.GetLineTop| | | + | | Text.GetAbsHeight() |
- | |txt.GetMaxLines| | | + | | Text.GetAbsWidth() |
- | |txt.Gettxt| | | + | | Text.GetHeight() | |
- | |txt.GetVisibility| | | + | | Text.GetLineCount() |
- | |txt.GetWidth| | | + | | Text.GetLineStart( line ) |
- | |txt.Release| | | + | | Text.GetLineTop( line ) |
- | |txt.SetBackColor| | | + | | Text.GetMaxLines() | |
- | |txt.SetBackGradient| | | + | | Text.GetPosition() |
- | |txt.SetBackGradientRadial| | | + | | Text.GetText() |
- | |txt.SetBackground| | | + | | Text.GetTextSize( mode ) |
- | |txt.SetHtml| | | + | | [[built_in: |
- | |txt.SetMargins| | | + | | Text.GetVisibility() | |
- | |txt.SetOnLongTouch| | | + | | Text.GetWidth() |
- | |txt.SetOnTouch| | | + | | Text.Release() | |
- | |txt.SetOnTouchDown| | | + | | Text.SetBackColor( color ) | |
- | |txt.SetOnTouchMove| | | + | | Text.SetBackGradient( color1, |
- | |txt.SetOnTouchUp| | | + | | Text.SetBackGradientRadial( x, |
- | |txt.SetPadding| | | + | | Text.SetBackground( imagefile, |
- | |txt.SetPosition| | | + | | Text.SetEllipsize( mode ) | Shorten long text with " |
- | |txt.SetSize| | | + | | Text.SetFontFile( file ) |
- | |txt.Settxt| | | + | | Text.SetHtml( html ) | |
- | |txt.SettxtColor| | | + | | Text.SetMargins( left, |
- | |txt.SettxtSize| | | + | | Text.SetOnLongTouch( callback ) |
- | |txt.SetTouchable| | | + | | Text.SetOnTouch( callback ) |
- | |txt.SetVisibility! ! | + | | 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 | ||
+ | | Monospace | ||
+ | | Multiline | ||
+ | | Right | | | ||
+ | | NoWrap | ||
+ | | Log | Log==' | ||
+ |