VirtualTextInputWidget#

class VirtualTextInputWidget#

A widget representing a text input field or text area.

Provides functionality for selection, cursor insertion point, and text area mode.

Inherited from VirtualWidget

__init__() None#

Create a new VirtualTextInputWidget instance.

get_insertion_point() int#

Get the current cursor location in the text input, represented by an index starting at 0.

For example, in “A|BCDEFG”, this function returns 1.

Returns:

Current cursor index.

get_selected_text() str#

Get the currently selected text in the input field.

Returns:

Selected text.

is_text_area() bool#

Check if the current input widget is a text area.

Returns:

True if it’s a text area, otherwise False.

set_insertion_point(insertion_point) None#

Set the current cursor location index in the text input.

See also: get_insertion_point()

Parameters:

insertion_point – Index starting from 0.

set_is_text_area(is_text_area) None#

Set whether the input widget is a text area.

Parameters:

is_text_area – True if it’s a text area, otherwise False.

set_selected_text(selected_text) None#

Set the currently selected text in the input field.

Parameters:

selected_text – Selected text string.