User Tools

Site Tools


built_in:textedit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
built_in:textedit [2015/01/15 17:06]
octazid more [Options]
built_in:textedit [2016/04/30 06:35] (current)
Line 1: Line 1:
 ====== TextEdit control ====== ====== TextEdit control ======
-===== Create ===== + 
-Create TextEdit objects using the CreateTextEdit method of the app object:+//(Information and examples taken from the DroidScript documentation)// 
 + 
 +===== Description ===== 
 +Create TextEdit objects using the **CreateTextEdit** method of the **[[built_in:app|app]]** object:
 <code>edt = app.CreateTextEdit( text, width, height, options );</code> <code>edt = app.CreateTextEdit( text, width, height, options );</code>
-You can use the SetOnChange method of the TextEdit to set the name of a function you want to be called when a the text is changed.+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( "Linear", "VCenter,FillXY" ); 
 + 
 +  edt = app.CreateTextEdit( "Edit me", 0.8, 0.3 ); 
 +  edt.SetOnChange( edt_OnChange ); 
 +  lay.AddChild( edt ); 
 + 
 +  txt = app.CreateText( "", 0.8, 0.3 ); 
 +  txt.SetMargins( 0, 0.02, 0, 0 ); 
 +  lay.AddChild( txt ); 
 + 
 +  app.AddLayout( lay ); 
 +
 + 
 +function edt_OnChange()   
 +
 +  txt.SetText( edt.GetText() ); 
 +}  
 +</code> 
 +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( "Linear", "VCenter,FillXY" ); 
 + 
 +  edt = app.CreateTextEdit( "Hello", 0.8, 0.4 ); 
 +  edt.SetTextColor( "#ff6666ff" ); 
 +  edt.SetBackColor( "#ffffffff" ); 
 +  lay.AddChild( edt ); 
 + 
 +  app.AddLayout( lay ); 
 +
 +</code> 
 +You can also set a background image/pattern or background gradient for the Text using the **SetBackground** and **SetBackGradient** functions. See **[[built_in:layouts|Layouts]]** for examples of how to use these functions.
  
-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                                                           ^ Description                                                                         
-|TextEdit.ClearHistory() | | +| TextEdit.ClearHistory()                                                                                                                              
-|TextEdit.Destroy() | | +| TextEdit.Destroy()                                                                                                                                   
-|TextEdit.GetAbsHeight() | | +| TextEdit.GetAbsHeight()                                                                                                                              
-|TextEdit.GetAbsWidth() | | +| TextEdit.GetAbsWidth()                                                                                                                               
-|TextEdit.GetCursorLine() | | +| TextEdit.GetCursorLine()                                         Returns the line with the Cursor as number                                          
-|TextEdit.GetCursorPos() | | +| TextEdit.GetCursorPos()                                          Returns the position of the Cursor as number                                        | 
-|TextEdit.GetHeight() | | +| TextEdit.GetHtml()                                               | Returns the Text of a Textedit as Html \\ use this if the contol has a Html option  
-|TextEdit.GetLineCount() | | +| TextEdit.GetHeight()                                                                                                                                 
-|TextEdit.GetLineStart( p1 ) | | +| TextEdit.GetLineCount()                                          Returns the count of a line in the Textedit                                         
-|TextEdit.GetLineTop( p1 ) | | +| TextEdit.GetLineStart( lineNum                                 Returns the position of the start of a line as number                               
-|TextEdit.GetMaxLines() | | +| TextEdit.GetLineTop( lineNum                                                                                                                       
-|TextEdit.GetPosition() | | +| TextEdit.GetMaxLines()                                           Returns the count of all lines                                                      
-|TextEdit.GetText() | | +| TextEdit.GetPosition()                                                                                                                               | 
-|TextEdit.GetTextSize( mode ) | | +| TextEdit.GetSelectedText()                                       | Returns the selected Text                                                           | 
-|TextEdit.GetType() | | +| TextEdit.GetSelectionEnd()                                       | Returns the endposition of the selected Text as number                              | 
-|TextEdit.GetVisibility() | | +| TextEdit.GetSelectionStart()                                     | Returns the startposition of the selected text as number                            
-|TextEdit.GetWidth() | | +| TextEdit.GetText()                                               Returns the Text of the Textedit                                                    
-|TextEdit.InsertText( text,start,end ) | | +| TextEdit.GetTextSize( mode )                                     Returns the Textsize of the Text                                                    
-|TextEdit.Redo() | | +| TextEdit.GetType()                                               Returns "TextEdit"                                                                  
-|TextEdit.Release() | | +| TextEdit.GetVisibility()                                                                                                                             
-|TextEdit.ReplaceText( text,start,end ) | | +| TextEdit.GetWidth()                                                                                                                                  
-|TextEdit.SetBackColor( p1 ) | | +| TextEdit.InsertText( text,start,end )                                                                                                                
-|TextEdit.SetBackGradient( p1,p2,p3,p4,p5,p6,p7 ) | | +| TextEdit.Redo()                                                                                                                                      
-|TextEdit.SetBackGradientRadial( p1,p2,p3,p4,p5,p6,p7 ) | | +| TextEdit.Release()                                                                                                                                   
-|TextEdit.SetBackground( p1,p2 ) | | +| TextEdit.ReplaceText( text,start,end )                                                                                                               
-|TextEdit.SetCursorPos( p1 ) | | +| TextEdit.SetBackColor( color                                                                                                                       
-|TextEdit.SetHint( text ) | | +| TextEdit.SetBackGradient( color1,color2,color3,p4,p5,p6,p7 )                                                                                         
-|TextEdit.SetHtml( p1 ) | | +| TextEdit.SetBackGradientRadial( x,y,r,color1,color2,color3,p7 )                                                                                      
-|TextEdit.SetMargins( left,top,right,bottom ) | | +| TextEdit.SetBackground( imagefile,options                                                                                                          
-|TextEdit.SetOnChange( p1 ) | | +| TextEdit.SetCursorPos( number                                                                                                                      
-|TextEdit.SetPadding( p1,p2,p3,p4 ) | | +| TextEdit.SetHint( text )                                                                                                                             
-|TextEdit.SetPosition( p1,p2,p3,p4 ) | | +| TextEdit.SetHtml( text                                                                                                                             
-|TextEdit.SetScale( x,y ) | | +| TextEdit.SetMargins( left,top,right,bottom )                                                                                                         
-|TextEdit.SetSize( p1,p2 ) | | +| TextEdit.SetOnChange( callback                                 Starts if the user change the Text in the Textedit                                  | 
-|TextEdit.SetText( p1 ) | | +| TextEdit.SetOnEnter( callback )|As of ver1.34 This disables enter key and fires callback| 
-|TextEdit.SetTextColor( p1 ) | | +| TextEdit.SetOnTouch( callback )                                  | Starts if the user enter the Textedit                                               
-|TextEdit.SetTextSize( size,mode ) | | +| TextEdit.SetPadding( left,top,right,bottom                                                                                                         
-|TextEdit.SetVisibility( p1 ) | | +| TextEdit.SetPosition( left,top,width,height                                                                                                        
-|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( width,height                                                                                                                     
 +| TextEdit.SetText( text                                                                                                                             
 +| TextEdit.SetTextColor( color                                                                                                                       
 +| TextEdit.SetTextSize( size,mode )                                                                                                                    
 +| TextEdit.SetVisibility( ShowHide                                                                                                                   
 +| TextEdit.Undo()                                                                                                                                      |
  
 ===== Options ===== ===== Options =====
  
-^Option ^Description ^ +^ Option      ^ Description                                                                  ^ 
-|Center|Justify the text in the middle| +| AutoSelect  | Select all Text if user enter the Textedit                                   | 
-|Left|Justify the text to the left| +| AutoSize    | Expand or shrink the control automatically so the text fits in the Textedit 
-|Monospace|Shows the Text in a Monospace Font| +| Bold        | Write bold text                                                              | 
-|NoSpell|Disable the spell-checker| +| Center      | Justify the text in the middle                                               | 
-|Number|Defaults to the numeric keyboard| +| Extract     | Allows full-width keyboard in landscape                                      
-|NoKeyboard|Shows no Keyboard| +| Left        | Justify the text to the left                                                 
-|ReadOnly|You cant change the Text| +| Monospace   | Shows the Text in a Monospace Font                                           
-|Right|Justify the text to the right|+| 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  | Doesn't make a linebreak if \\ text is longer than the control               |
built_in/textedit.1421341595.txt.gz · Last modified: 2015/01/16 01:06 (external edit)