This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
built_in:textedit [2015/01/07 09:53] octazid [Methods] |
built_in:textedit [2016/04/29 22:32] 58.96.146.120 [Methods] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== TextEdit control ====== | ====== TextEdit control ====== | ||
- | ===== Create | + | |
- | Create TextEdit objects using the CreateTextEdit method of the app object: | + | // |
+ | |||
+ | ===== Description | ||
+ | Create TextEdit objects using the **CreateTextEdit** method of the **[[built_in: | ||
< | < | ||
- | You can use the SetOnChange | + | You can use the **SetOnChange** or the **SetOnTouch** methods |
+ | Use the **SetText** and **GetText** functions to set and get the text in the TextEdit. | ||
+ | |||
+ | ==== Example - Using OnChange ==== | ||
+ | <code javascript> | ||
+ | function OnStart() | ||
+ | { | ||
+ | lay = app.CreateLayout( " | ||
+ | |||
+ | edt = app.CreateTextEdit( "Edit me", 0.8, 0.3 ); | ||
+ | edt.SetOnChange( edt_OnChange ); | ||
+ | lay.AddChild( edt ); | ||
+ | |||
+ | txt = app.CreateText( "", | ||
+ | txt.SetMargins( 0, 0.02, 0, 0 ); | ||
+ | lay.AddChild( txt ); | ||
+ | |||
+ | app.AddLayout( lay ); | ||
+ | } | ||
+ | |||
+ | function edt_OnChange() | ||
+ | { | ||
+ | txt.SetText( edt.GetText() ); | ||
+ | } | ||
+ | </ | ||
+ | You can change the look of a Text using the **SetBackColor** and **SetTextColor** functions on the Text object. | ||
+ | |||
+ | ==== Example - Blue on White ==== | ||
+ | <code javascript> | ||
+ | function OnStart() | ||
+ | { | ||
+ | lay = app.CreateLayout( " | ||
+ | |||
+ | edt = app.CreateTextEdit( " | ||
+ | edt.SetTextColor( "# | ||
+ | edt.SetBackColor( "# | ||
+ | lay.AddChild( edt ); | ||
+ | |||
+ | app.AddLayout( lay ); | ||
+ | } | ||
+ | </ | ||
+ | You can also set a background image/ | ||
- | Use the SetText and GetText functions to set and get the text in the TextEdit | ||
===== Methods ===== | ===== Methods ===== | ||
Some controls use the same methods.\\ | Some controls use the same methods.\\ | ||
For examples of the **[[same methods]]** look here. | For examples of the **[[same methods]]** look here. | ||
- | ^Method ^Description ^ | + | ^ Method |
- | |TextEdit.ClearHistory() | | | + | | TextEdit.ClearHistory() |
- | |TextEdit.Destroy() | | | + | | TextEdit.Destroy() |
- | |TextEdit.GetAbsHeight() | | | + | | TextEdit.GetAbsHeight() |
- | |TextEdit.GetAbsWidth() | | | + | | TextEdit.GetAbsWidth() |
- | |TextEdit.GetCursorLine() | | | + | | TextEdit.GetCursorLine() |
- | |TextEdit.GetCursorPos() | | | + | | TextEdit.GetCursorPos() |
- | |TextEdit.GetHeight() | | | + | | TextEdit.GetHtml() |
- | |TextEdit.GetLineCount() | | | + | | TextEdit.GetHeight() |
- | |TextEdit.GetLineStart( | + | | TextEdit.GetLineCount() |
- | |TextEdit.GetLineTop( | + | | TextEdit.GetLineStart( |
- | |TextEdit.GetMaxLines() | | | + | | TextEdit.GetLineTop( |
- | |TextEdit.GetPosition() | | | + | | TextEdit.GetMaxLines() |
- | |TextEdit.GetText() | | | + | | TextEdit.GetPosition() |
- | |TextEdit.GetTextSize( mode ) | | | + | | TextEdit.GetSelectedText() |
- | |TextEdit.GetType() | | | + | | TextEdit.GetSelectionEnd() |
- | |TextEdit.GetVisibility() | | | + | | TextEdit.GetSelectionStart() |
- | |TextEdit.GetWidth() | | | + | | TextEdit.GetText() |
- | |TextEdit.InsertText( text, | + | | TextEdit.GetTextSize( mode ) |
- | |TextEdit.Redo() | | | + | | TextEdit.GetType() |
- | |TextEdit.Release() | | | + | | TextEdit.GetVisibility() |
- | |TextEdit.ReplaceText( text, | + | | TextEdit.GetWidth() |
- | |TextEdit.SetBackColor( | + | | TextEdit.InsertText( text, |
- | |TextEdit.SetBackGradient( | + | | TextEdit.Redo() |
- | |TextEdit.SetBackGradientRadial( | + | | TextEdit.Release() |
- | |TextEdit.SetBackground( | + | | TextEdit.ReplaceText( text, |
- | |TextEdit.SetCursorPos( | + | | TextEdit.SetBackColor( |
- | |TextEdit.SetHint( text ) | | | + | | TextEdit.SetBackGradient( |
- | |TextEdit.SetHtml( | + | | TextEdit.SetBackGradientRadial( |
- | |TextEdit.SetMargins( left, | + | | TextEdit.SetBackground( |
- | |TextEdit.SetOnChange( | + | | TextEdit.SetCursorPos( |
- | |TextEdit.SetPadding( | + | | TextEdit.SetHint( text ) |
- | |TextEdit.SetPosition( | + | | TextEdit.SetHtml( |
- | |TextEdit.SetScale( x,y ) | | | + | | TextEdit.SetMargins( left, |
- | |TextEdit.SetSize( | + | | TextEdit.SetOnChange( |
- | |TextEdit.SetText( | + | | TextEdit.SetOnEnter( callback )|As of ver1.34 This disables enter key and fires callback |
- | |TextEdit.SetTextColor( | + | | TextEdit.SetOnTouch( callback ) | Starts if the user enter the Textedit |
- | |TextEdit.SetTextSize( size,mode ) | | | + | | TextEdit.SetPadding( |
- | |TextEdit.SetVisibility( | + | | TextEdit.SetPosition( |
- | |TextEdit.Undo() | + | | TextEdit.SetScale( x,y ) |
+ | | TextEdit.SetSelection( start,stop ) | Select Text \\ start and stop are the positions in the text as number | ||
+ | | TextEdit.SetSize( | ||
+ | | TextEdit.SetText( | ||
+ | | TextEdit.SetTextColor( | ||
+ | | TextEdit.SetTextSize( size,mode ) | | ||
+ | | TextEdit.SetVisibility( | ||
+ | | TextEdit.Undo() | ||
===== Options ===== | ===== Options ===== | ||
- | ^Option ^Description ^ | + | ^ Option |
- | |Left|Justify the text to the left| | + | | AutoSelect |
- | |NoSpell|Disable the spell-checker| | + | | AutoSize |
- | |Number|Defaults to the numeric keyboard| | + | | Bold | Write bold text | |
+ | | Center | ||
+ | | Extract | ||
+ | | Left | Justify the text to the left | | ||
+ | | Monospace | ||
+ | | NoSpell | ||
+ | | Number | ||
+ | | NoKeyboard | ||
+ | | ReadOnly | ||
+ | | Right | Justify the text to the right | | ||
+ | | SingleLine |