Package libavg :: Module textarea :: Class FocusContext

Class FocusContext

source code

This class helps to group TextArea elements

TextArea elements that belong to the same FocusContext cycle focus among themselves. There can be several FocusContextes but only one active at once ( using the global function setActiveFocusContext() )

Instance Methods
 
__init__(self) source code
 
isActive(self)
Test if this FocusContext is currently active
source code
 
register(self, taElement)
Register a floating textarea on this FocusContext
source code
 
getFocused(self)
Query the TextArea element that currently has focus
source code
 
keyCharPressed(self, kchar)
Inject an utf-8 encoded characted into the flow
source code
 
keyUCodePressed(self, keycode)
Inject an Unicode code point into the flow
source code
 
backspace(self)
Emulate a backspace character keypress
source code
 
delete(self)
Emulate a delete character keypress
source code
 
clear(self)
Clear the active textarea, emulating the press of FF character
source code
 
resetFocuses(self)
Blur every TextArea registered within this FocusContext
source code
 
cycleFocus(self, backwards=False)
Force a focus cycle among instantiated textareas
source code
 
getRegistered(self)
Returns a list of TextArea currently registered within this FocusContext
source code
Method Details

register(self, taElement)

source code 

Register a floating textarea on this FocusContext

Parameters:
  • taElement - a TextArea instance

getFocused(self)

source code 

Query the TextArea element that currently has focus

Returns:
TextArea instance or None

keyCharPressed(self, kchar)

source code 

Inject an utf-8 encoded characted into the flow

Shift a character (Unicode keycode) into the active (w/focus) TextArea

Parameters:
  • kchar (string) - a single character (if more than one, the following are ignored)

keyUCodePressed(self, keycode)

source code 

Inject an Unicode code point into the flow

Shift a character (Unicode keycode) into the active (w/focus) TextArea

Parameters:
  • keycode (int) - unicode code point of the character

cycleFocus(self, backwards=False)

source code 

Force a focus cycle among instantiated textareas

TAB/Sh-TAB keypress is what is translated in a focus cycle.

Parameters:
  • backwards - as default, the method cycles following the order that has been followed during the registration of TextArea instances. Setting this to True, the order is inverted.

getRegistered(self)

source code 

Returns a list of TextArea currently registered within this FocusContext

Returns:
a list of registered TextArea instances