Package libavg :: Module textarea :: Class TextArea

Class TextArea

source code

TextArea is an extended <words> node that reacts to user input (mouse/touch for focus, keyboard for text input). It sits in a given container matching its dimensions

Instance Methods
 
__init__(self, parent, focusContext=None, bgImageFile=None, disableMouseFocus=False, blurOpacity=0.3, border=0, id='', cursorPixFile=None) source code
 
clearFocus(self)
Compact form to blur the TextArea
source code
 
clearText(self)
Clears the text
source code
 
getID(self)
Returns the ID of the textarea (set on the constructor).
source code
 
getText(self)
Get the text stored and displayed on the TextArea
source code
 
hasFocus(self)
Query the focus status for this TextArea
source code
 
onKeyDown(self, keycode) source code
 
setFocus(self, hasFocus)
Force the focus (or blur) of this TextArea
source code
 
setMaxLength(self, maxlen)
Set character limit of the input
source code
 
setStyle(self, font='Arial', size=12, alignment='left', variant='Regular', color='000000', multiline=True, cursorWidth=None, flashingCursor=False)
Set some style parameters of the <words> node of the TextArea
source code
 
setText(self, uString)
Set the text on the TextArea
source code
Method Details

__init__(self, parent, focusContext=None, bgImageFile=None, disableMouseFocus=False, blurOpacity=0.3, border=0, id='', cursorPixFile=None)
(Constructor)

source code 
Parameters:
  • parent - a div node with defined dimensions
  • focusContext - FocusContext object which groups focus for TextArea elements
  • bgImageFile - path and file name (relative to mediadir) of an image that is used as a background for TextArea. The image is stretched to extents of the instance
  • disableMouseFocus - boolean, prevents that mouse can set focus for this instance
  • blurOpacity - opacity that textarea gets when goes to blur state
  • border - amount of offsetting pixels that words node will have from image extents
  • id - optional handle to identify the object when dealing with events. ID uniqueness is not guaranteed
  • cursorPixFile - one-pixel graphic file used to render the cursor. The default one is a black one

getID(self)

source code 
Returns the ID of the textarea (set on the constructor). Useful with single-entry callbacks

setFocus(self, hasFocus)

source code 
Force the focus (or blur) of this TextArea
Parameters:
  • hasFocus - boolean

setMaxLength(self, maxlen)

source code 
Set character limit of the input
Parameters:
  • maxlen - max number of character allowed

setStyle(self, font='Arial', size=12, alignment='left', variant='Regular', color='000000', multiline=True, cursorWidth=None, flashingCursor=False)

source code 
Set some style parameters of the <words> node of the TextArea
Parameters:
  • font - font face
  • size - font size in pixels
  • alignment - one among 'left', 'right', 'center'
  • variant - font variant (eg: 'bold')
  • color - RGB hex text color
  • multiline - boolean, whether TextArea has to wrap (undefinitely) or stop at full width
  • cursorWidth - int, width of the cursor in pixels

setText(self, uString)

source code 
Set the text on the TextArea
Parameters:
  • uString - an unicode string