This shows you the differences between two versions of the page.
built_in:textedit [2015/03/08 09:51] octazid completed |
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 ^Description ^ | ||
- | |TextEdit.ClearHistory() | | | ||
- | |TextEdit.Destroy() | | | ||
- | |TextEdit.GetAbsHeight() | | | ||
- | |TextEdit.GetAbsWidth() | | | ||
- | |TextEdit.GetCursorLine() | Returns the line with the Cursor as number| | ||
- | |TextEdit.GetCursorPos() | Returns the position of the Cursor as number| | ||
- | |TextEdit.GetHtml()| Returns the Text of a Textedit as Html \\ use this if the contol has a Html option| | ||
- | |TextEdit.GetHeight() | | | ||
- | |TextEdit.GetLineCount() | Returns the count of a line in the Textedit| | ||
- | |TextEdit.GetLineStart( lineNum ) | Returns the position of the start of a line as number| | ||
- | |TextEdit.GetLineTop( lineNum ) | | | ||
- | |TextEdit.GetMaxLines() | Returns the count of all lines| | ||
- | |TextEdit.GetPosition() | | | ||
- | |TextEdit.GetSelectedText()| Returns the selected Text| | ||
- | |TextEdit.GetSelectionEnd()| Returns the endposition of the selected Text as number| | ||
- | |TextEdit.GetSelectionStart()| Returns the startposition of the selected text as number| | ||
- | |TextEdit.GetText() | Returns the Text of the Textedit | | ||
- | |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.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 ^Description ^ | ||
- | |AutoSelect|Select all Text if user enter the Textedit| | ||
- | |Center|Justify the text in the middle| | ||
- | |Left|Justify the text to the left| | ||
- | |Monospace|Shows the Text in a Monospace Font| | ||
- | |NoSpell|Disable the spell-checker| | ||
- | |Number|Defaults to the numeric keyboard| | ||
- | |NoKeyboard|Shows no Keyboard| | ||
- | |ReadOnly|You cant change the Text| | ||
- | |Right|Justify the text to the right| | ||
- | |SingleLine|Does' |