The Textbox class is a Control subclass. The control value can be set to a long text string, which can be scrolled. The text applied will undergo formating that includes wordwrap, and custom format methods can be linked in with the add_format method.
If the clipboard is enabled with the Control parameter text_paste, the control can use the copy and paste feature with the mouse while holding SHIFT and CTRL. The clipboard functionality in Pyjsdl handled by pyjsdl.display.textarea displayed by textarea.toggle(). For a control of identity 'Control', the clipboard access results in reporting in the InterfaceState object as button 'Control_copy' and 'Control_paste'.
|
|
format_text(self)
Format text to display in textbox. Format include splitting text into lines, apply custom format functions, then wordwrap to fit in textbox. |
|
|
|
|
add_format(self,
function,
obj=None)
Custom format functions. Parameter function is a list of functions that will be applied to text formatting. The functions should receive a text argument, and return the formated text. Passing string 'splitlines', 'nosplitlines', 'wordwrap', 'nowordwrap' will modify standard format procedure. Optional obj argument to provide object for method binding in Pyjs -O mode. |
|
|
|
|
set_line_max(self,
line=None)
Set max lines of textbox. Optional line parameter. |
|
|
|
|
get_line_max(self)
Get max lines of textbox. |
|
|
|
|
set_line_width(self,
width=None)
Set width of line, margin included. If width is None, reset to textbox width. |
|
|
|
|
get_line_width(self)
Get line width. |
|
|
|
|
check_size(self,
text)
Get size required for given text. |
|
|
|
|
get_size(self,
*text)
Get size of textbox. Optional parameter (col,row) to return estimated width for col and height for row, adjusted for margins. |
|
|
|
|
|
|
|
set_value(self,
value)
Set the value of a control. Parameters: value - control value. |
|
|
|
|
get_value(self,
format_text=False)
Get the value of a control. Parameter: format_text bool to retrieve formatted text list rather than nonformatted text string, defaults to False. |
|
|
|
|
text_copy(self)
Copy text to clipboard. |
|
|
|
|
text_paste(self)
Paste text from clipboard. |
|
|
|
|
set_scroll_line(self,
line)
Set number of line to scroll. |
|
|
|
|
get_text(self,
display=False)
Get formated text lines. Parameter: display set to True to get lines currently showing, defaults to False to get all text lines. |
|
|
|
|
next(self,
line=None)
Scroll text forward. Parameter: line to scroll, defaults to one line. |
|
|
|
|
previous(self,
line=None)
Scroll text reverse. Parameter: line to scroll, defaults to one line. |
|
|
|
Inherited from Control:
__init__,
add_action,
check_link,
get_display_text,
get_id,
get_label,
get_list,
get_list_index,
get_position,
get_text_margin,
get_tip,
is_activated,
is_activated_lock,
is_active,
is_enabled,
remove_list,
reset,
set_activated,
set_activated_lock,
set_active,
set_color,
set_control_image,
set_display_info,
set_display_text,
set_enabled,
set_label,
set_label_info,
set_label_text,
set_link,
set_link_activated,
set_list,
set_list_icon,
set_list_index,
set_text_margin,
set_tip
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__,
__subclasshook__
|