This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:text [2014/12/05 13:29] 162.252.85.172 [Methods] |
built_in:text [2019/06/22 01:01] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Text control ====== | ====== Text control ====== | ||
- | ===== Create ===== | ||
- | Create Text objects using the **CreateText** method of the [[app]] object: | ||
+ | // | ||
+ | |||
+ | ===== Description ===== | ||
+ | Create Text objects using the **CreateText** method of the **[[app]]** object: | ||
< | < | ||
You can use the **" | You can use the **" | ||
- | Use the SetText and GetText functions of the Text object to set and get it's text. | + | 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.\\ |
- | |Text.Destroy() | | | + | For examples of the **[[same methods]]** look here. |
- | |Text.GetAbsHeight() | | | + | ^ Method |
- | |Text.GetAbsWidth() | | | + | | Text.Destroy() |
- | |Text.GetHeight() | | | + | | Text.GetAbsHeight() |
- | |Text.GetLineCount() | | | + | | Text.GetAbsWidth() |
- | |Text.GetLineStart( line ) | | | + | | Text.GetHeight() |
- | |Text.GetLineTop( line ) | | | + | | Text.GetLineCount() |
- | |Text.GetMaxLines() | | | + | | Text.GetLineStart( line ) | |
- | |Text.GetPosition() | | | + | | Text.GetLineTop( line ) | |
- | |Text.GetText() | | | + | | Text.GetMaxLines() |
- | |Text.GetTextSize( mode ) | | | + | | Text.GetPosition() |
- | |Text.GetType() | | | + | | Text.GetText() |
- | |Text.GetVisibility() | | | + | | Text.GetTextSize( mode ) |
- | |Text.GetWidth() | | | + | | [[built_in: |
- | |Text.Release() | | | + | | Text.GetVisibility() |
- | |Text.SetBackColor( | + | | Text.GetWidth() |
- | |Text.SetBackGradient( | + | | Text.Release() |
- | |Text.SetBackGradientRadial( | + | | Text.SetBackColor( |
- | |Text.SetBackground( | + | | Text.SetBackGradient( |
- | |Text.SetEllipsize( mode ) | | | + | | Text.SetBackGradientRadial( |
- | |Text.SetFontFile( file ) | | | + | | Text.SetBackground( |
- | |Text.SetHtml( html ) | | | + | | Text.SetEllipsize( mode ) | Shorten long text with " |
- | |Text.SetMargins( left, | + | | Text.SetFontFile( file ) |
- | |Text.SetOnLongTouch( callback ) | | | + | | Text.SetHtml( html ) |
- | |Text.SetOnTouch( callback ) | | | + | | Text.SetMargins( left, |
- | |Text.SetOnTouchDown( callback ) | | | + | | Text.SetOnLongTouch( callback ) | |
- | |Text.SetOnTouchMove( callback ) | | | + | | Text.SetOnTouch( callback ) | |
- | |Text.SetOnTouchUp( callback ) | | | + | | Text.SetOnTouchDown( callback ) | |
- | |Text.SetPadding( | + | | Text.SetOnTouchMove( callback ) | |
- | |Text.SetPosition( | + | | Text.SetOnTouchUp( callback ) | |
- | |Text.SetScale( x,y ) | | | + | | Text.SetPadding( |
- | |Text.SetSize( | + | | Text.SetPosition( |
- | |Text.SetText( text ) | | | + | | Text.SetScale( x,y ) |
- | |Text.SetTextColor( color ) | | | + | | Text.SetSize( |
- | |Text.SetTextShadow( radius, | + | | Text.SetText( text ) |
- | |Text.SetTextSize( size,mode ) | | | + | | Text.SetTextColor( color ) |
- | |Text.SetTouchable( touchable ) | | | + | | Text.SetTextShadow( radius, |
- | |Text.SetVisibility( HideShow ) | | | + | | 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==' | ||
+ |