This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
built_in:textedit [2014/09/17 19:01] stevegarman created |
built_in:textedit [2016/04/29 22:35] 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 TextEd | ||
===== Methods ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | Some controls use the same methods.\\ |
- | |edt.ClearHistory| | | + | For examples of the **[[same methods]]** look here. |
- | |edt.GetCursorLine| | | + | ^ Method |
- | |edt.GetCursorPos| | | + | | TextEdit.ClearHistory() | | |
- | |edt.GetHeight| | | + | | TextEdit.Destroy() |
- | |edt.GetLineCount| | | + | | TextEdit.GetAbsHeight() |
- | |edt.GetLineStart| | | + | | TextEdit.GetAbsWidth() |
- | |edt.GetLineTop| | | + | | TextEdit.GetCursorLine() | Returns the line with the Cursor as number |
- | |edt.GetMaxLines| | | + | | TextEdit.GetCursorPos() |
- | |edt.GetText| | | + | | TextEdit.GetHtml() |
- | |edt.GetVisibility| | | + | | TextEdit.GetHeight() | |
- | |edt.GetWidth| | | + | | TextEdit.GetLineCount() |
- | |edt.Redo| | | + | | TextEdit.GetLineStart( lineNum ) | Returns the position of the start of a line as number |
- | |edt.Release| | | + | | TextEdit.GetLineTop( lineNum ) | |
- | |edt.SetBackColor| | | + | | TextEdit.GetMaxLines() | Returns the count of all lines |
- | |edt.SetBackGradient| | | + | | TextEdit.GetPosition() |
- | |edt.SetBackGradientRadial| | | + | | TextEdit.GetSelectedText() |
- | |edt.SetBackground| | | + | | TextEdit.GetSelectionEnd() |
- | |edt.SetCursorPos| | | + | | TextEdit.GetSelectionStart() |
- | |edt.SetHtml| | | + | | TextEdit.GetText() | Returns the Text of the Textedit |
- | |edt.SetMargins| | | + | | TextEdit.GetTextSize( mode ) | Returns the Textsize of the Text | |
- | |edt.SetOnChange| | | + | | TextEdit.GetType() |
- | |edt.SetPadding| | | + | | TextEdit.GetVisibility() | |
- | |edt.SetPosition| | | + | | TextEdit.GetWidth() |
- | |edt.SetSize| | | + | | TextEdit.InsertText( text, |
- | |edt.SetText| | | + | | TextEdit.Redo() |
- | |edt.SetTextColor| | | + | | TextEdit.Release() |
- | |edt.SetTextSize| | | + | | TextEdit.ReplaceText( text, |
- | |edt.SetVisibility| | | + | | TextEdit.SetBackColor( color ) | |
- | |edt.Undo| | | + | | TextEdit.SetBackGradient( color1, |
+ | | TextEdit.SetBackGradientRadial( x, | ||
+ | | TextEdit.SetBackground( imagefile, | ||
+ | | TextEdit.SetCursorPos( number ) | ||
+ | | TextEdit.SetHint( text ) | ||
+ | | TextEdit.SetHtml( text ) | | ||
+ | | TextEdit.SetMargins( left, | ||
+ | | TextEdit.SetOnChange( callback ) | Starts if the user change the Text in the Textedit | ||
+ | | TextEdit.SetOnEnter( callback )|As of ver1.34 This disables enter key and fires callback| | ||
+ | | TextEdit.SetOnTouch( callback ) | Starts if the user enter the Textedit | ||
+ | | TextEdit.SetPadding( left, | ||
+ | | TextEdit.SetPosition( left, | ||
+ | | TextEdit.SetScale( x,y ) | ||
+ | | TextEdit.SetSelection( start,stop ) | ||
+ | | TextEdit.SetSize( width, | ||
+ | | TextEdit.SetText( text ) | | ||
+ | | TextEdit.SetTextColor( color ) | | ||
+ | | TextEdit.SetTextSize( size,mode ) | ||
+ | | TextEdit.SetVisibility( ShowHide ) | | ||
+ | | TextEdit.Undo() | | | ||
+ | |||
+ | ===== Options ===== | ||
+ | |||
+ | ^ Option | ||
+ | | AutoSelect | ||
+ | | AutoSize | ||
+ | | 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 |