This shows you the differences between two versions of the page.
built_in:textedit [2016/04/29 22:32] 58.96.146.120 [Methods] |
built_in:textedit [2016/04/30 06:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== TextEdit control ====== | ||
- | // | ||
- | |||
- | ===== Description ===== | ||
- | Create TextEdit objects using the **CreateTextEdit** method of the **[[built_in: | ||
- | < | ||
- | You can use the **SetOnChange** or the **SetOnTouch** methods of the TextEdit to set the name of a function you want to be called when a the text is changed. | ||
- | 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/ | ||
- | |||
- | ===== Methods ===== | ||
- | Some controls use the same methods.\\ | ||
- | For examples of the **[[same methods]]** look here. | ||
- | ^ Method | ||
- | | TextEdit.ClearHistory() | ||
- | | TextEdit.Destroy() | ||
- | | TextEdit.GetAbsHeight() | ||
- | | TextEdit.GetAbsWidth() | ||
- | | TextEdit.GetCursorLine() | ||
- | | TextEdit.GetCursorPos() | ||
- | | TextEdit.GetHtml() | ||
- | | TextEdit.GetHeight() | ||
- | | TextEdit.GetLineCount() | ||
- | | TextEdit.GetLineStart( lineNum ) | Returns the position of the start of a line as number | ||
- | | TextEdit.GetLineTop( lineNum ) | ||
- | | TextEdit.GetMaxLines() | ||
- | | TextEdit.GetPosition() | ||
- | | TextEdit.GetSelectedText() | ||
- | | TextEdit.GetSelectionEnd() | ||
- | | TextEdit.GetSelectionStart() | ||
- | | TextEdit.GetText() | ||
- | | TextEdit.GetTextSize( mode ) | Returns the Textsize of the Text | | ||
- | | TextEdit.GetType() | ||
- | | TextEdit.GetVisibility() | ||
- | | TextEdit.GetWidth() | ||
- | | TextEdit.InsertText( text, | ||
- | | TextEdit.Redo() | ||
- | | TextEdit.Release() | ||
- | | TextEdit.ReplaceText( text, | ||
- | | TextEdit.SetBackColor( color ) | ||
- | | 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 ) | Select Text \\ start and stop are the positions in the text as number | ||
- | | 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 |