Skip to main content

widget.textbox

local textbox = require "widget.textbox"

NEWLINE

(field) NEWLINE: integer

Indicates on a widget.styledtext that a new line follows.


__index

(field) __index: core.object

active

(field) active: boolean

animations

(field) animations: widget.animation[]

background_color

(field) background_color: renderer.color

Array of bytes that represents a color used by the rendering functions.


border

(field) border: widget.border

Represents the border of a widget.


captured_widget

(field) captured_widget: widget

Widget that captured mouse events


child_active

(field) child_active: widget|nil

A base widget


childs

(field) childs: table<integer, widget>

clickable

(field) clickable: boolean

context

(field) context: 'application'|'session'

current_scale

(field) current_scale: number

cursor

(field) cursor: string

defer_draw

(field) defer_draw: boolean

drag_select

(field) drag_select: boolean|table

draggable

(field) draggable: boolean

dragged

(field) dragged: boolean

explicit_update

(field) explicit_update: boolean

font

(field) font: string|renderer.font|widget.fontreference

Represents a reference to a font stored elsewhere.


force_events

(field) force_events: table

foreground_color

(field) foreground_color: renderer.color

Array of bytes that represents a color used by the rendering functions.


h_scrollbar

(field) h_scrollbar: widget.scrollbar

has_focus

(field) has_focus: boolean

hover_border

(field) hover_border: unknown

hovered_scrollbar

(field) hovered_scrollbar: boolean

input_text

(field) input_text: boolean

this widget is for text input


is_scrolling

(field) is_scrolling: boolean

label

(field) label: string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>

mouse

(field) mouse: widget.position

Represents the position of a widget.


mouse_is_hovering

(field) mouse_is_hovering: boolean

mouse_is_pressed

(field) mouse_is_pressed: boolean

mouse_pressed_outside

(field) mouse_pressed_outside: boolean

name

(field) name: string

next_zindex

(field) next_zindex: integer

parent

(field) parent: widget|nil

A base widget


perform_update_size_position

(field) perform_update_size_position: boolean

placeholder

(field) placeholder: string

placeholder_active

(field) placeholder_active: boolean

position

(field) position: widget.position

Represents the position of a widget.


prev_height

(field) prev_height: number?

prev_size

(field) prev_size: widget.position

Represents the position of a widget.


prev_view

(field) prev_view: unknown

prev_width

(field) prev_width: number?

render_background

(field) render_background: boolean

scroll

(field) scroll: core.view.scroll

scrollable

(field) scrollable: boolean

set_focus

(field) set_focus: any

size

(field) size: widget.position

Modifying this property directly is not advised, use set_size() instead.


skip_scroll_ctrl

(field) skip_scroll_ctrl: boolean

By default is set to true to allow ctrl+wheel or cmd+wheel on mac to scale the interface, you can set it to false on your parent widget to allow manually intercepting ctrl+wheel.


super

(field) super: widget

A base widget


textview

(field) textview: widget.textbox.TextView

tooltip

(field) tooltip: (string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>)?

tooltip_command

(field) tooltip_command: string?

type_name

(field) type_name: string

v_scrollbar

(field) v_scrollbar: widget.scrollbar

visible

(field) visible: boolean

zindex

(field) zindex: integer

widget.textbox.SingleLineDoc

__index

(field) __index: core.object

abs_filename

(field) abs_filename: any

binary

(field) binary: boolean

bom

(field) bom: string?

cache

(field) cache: table

clean_change_id

(field) clean_change_id: integer

clean_lines

(field) clean_lines: table

crlf

(field) crlf: boolean

encoding

(field) encoding: string?

filename

(field) filename: any

highlighter

(field) highlighter: unknown

last_selection

(field) last_selection: number

lines

(field) lines: table

new_file

(field) new_file: any

overwrite

(field) overwrite: boolean

redo_stack

(field) redo_stack: table

selections

(field) selections: table

super

(field) super: core.doc

syntax

(field) syntax: table|unknown

undo_stack

(field) undo_stack: table

__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) core.doc:__tostring()
-> string

add_selection

(method) core.doc:add_selection(line1: any, col1: any, line2: any, col2: any, swap: any)

clean

(method) core.doc:clean()

clear_cache

(method) core.doc:clear_cache(l: any, n: any)

delete_to

(method) core.doc:delete_to(...any)

delete_to_cursor

(method) core.doc:delete_to_cursor(idx: any, ...any)

extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


get_change_id

(method) core.doc:get_change_id()
-> integer

get_char

(method) core.doc:get_char(line: any, col: any)
-> string

get_indent_info

(method) core.doc:get_indent_info()
-> "hard"|"soft"
2. number
3. boolean

get_indent_string

(method) core.doc:get_indent_string(col: any)
-> string

get_line_indent

(method) core.doc:get_line_indent(line: any, rnd_up: any)
-> unknown
2. string
3. integer|nil

returns the size of the original indent, and the indent in your config format, rounded either up or down


get_name

(method) core.doc:get_name()
-> unknown

get_non_word_chars

(method) core.doc:get_non_word_chars(symbol: boolean)
-> string

Get a string of characters not belonging to a word taking into account current subsyntax.

Note: when setting symbol param to true the characters property symbol_non_word_chars will be searched, if false non_word_chars. In both cases will fallback to config.non_word_chars when not found.

@param symbol — Indicates if non word characters are for a symbol


get_selection

(method) core.doc:get_selection(sort: any)
-> integer
2. integer
3. integer
4. integer
5. boolean

Cursor section. Cursor indices are only valid during a get_selections() call. Cursors will always be iterated in order from top to bottom. Through normal operation curors can never swap positions; only merge or split, or change their position in cursor order.


get_selection_idx

(method) core.doc:get_selection_idx(idx: integer, sort?: boolean)
-> integer
2. integer
3. integer
4. integer
5. boolean?

Get the selection specified by idx

@param idx — the index of the selection to retrieve

@param sort — whether to sort the selection returned

@return — line1, col1, line2, col2, was the selection sorted


get_selection_text

(method) core.doc:get_selection_text(limit: any)
-> string

get_selections

(method) core.doc:get_selections(sort_intra: any, idx_reverse: any)
-> function
2. table
3. number

If idx_reverse is true, it'll reverse iterate. If nil, or false, regular iterate. If a number, runs for exactly that iteration.


get_symbol_pattern

(method) core.doc:get_symbol_pattern()
-> string

Get the lua pattern used to match symbols taking into account current subsyntax.


get_text

(method) core.doc:get_text(line1: integer, col1: integer, line2: integer, col2: integer, inclusive?: boolean)
-> string

Returns the content of the doc between two positions. The positions will be sanitized and sorted. The character at the "end" position is not included by default.

@param inclusive — Whether or not to return the character at the last position

See: [core.doc.sanitize_position](file:///usr/share/pragtical/core/doc/init.lua#401#9)


get_utf8_line

(method) core.doc:get_utf8_line(idx: integer)
-> string

Always returns a valid utf8 line even if the file contains binary data.


has_any_selection

(method) core.doc:has_any_selection()
-> boolean

has_selection

(method) core.doc:has_selection()
-> boolean

ime_text_editing

(method) core.doc:ime_text_editing(text: any, start: any, length: any, idx: any)

indent_text

(method) core.doc:indent_text(unindent: any, line1: any, col1: any, line2: any, col2: any)
-> unknown
2. integer|unknown
3. unknown
4. integer|unknown

un/indents text; behaviour varies based on selection and un/indent.

  • if there's a selection, it will stay static around the text for both indenting and unindenting.
  • if you are in the beginning whitespace of a line, and are indenting, the cursor will insert the exactly appropriate amount of spaces, and jump the cursor to the beginning of first non whitespace characters
  • if you are not in the beginning whitespace of a line, and you indent, it inserts the appropriate whitespace, as if you typed them normally.
  • if you are unindenting, the cursor will jump to the start of the line, and remove the appropriate amount of spaces (or a tab).

insert

(method) widget.textbox.SingleLineDoc:insert(line: any, col: any, text: any)

is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_dirty

(method) core.doc:is_dirty()
-> boolean

is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


load

(method) core.doc:load(filename: any)

merge_cursors

(method) core.doc:merge_cursors(idx: any)

move_to

(method) core.doc:move_to(...any)

move_to_cursor

(method) core.doc:move_to_cursor(idx: any, ...any)

needs_encoding_conversion

(method) core.doc:needs_encoding_conversion()
-> boolean

new

(method) core.doc:new(filename: any, abs_filename: any, new_file: any)

on_close

(method) core.doc:on_close()

For plugins to get notified when a document is closed


on_text_change

(method) core.doc:on_text_change(type: any)

For plugins to add custom actions of document change


position_offset

(method) core.doc:position_offset(line: any, col: any, ...any)

raw_insert

(method) core.doc:raw_insert(line: any, col: any, text: any, undo_stack: any, time: any)

raw_remove

(method) core.doc:raw_remove(line1: any, col1: any, line2: any, col2: any, undo_stack: any, time: any)

redo

(method) core.doc:redo()

reload

(method) core.doc:reload()

remove

(method) core.doc:remove(line1: any, col1: any, line2: any, col2: any)

remove_selection

(method) core.doc:remove_selection(idx: any)

replace

(method) core.doc:replace(fn: any)
-> table

replace_cursor

(method) core.doc:replace_cursor(idx: any, line1: any, col1: any, line2: any, col2: any, fn: any)
-> unknown

reset

(method) widget.textbox.SingleLineDoc:reset()

reset_syntax

(method) core.doc:reset_syntax()

sanitize_position

(method) core.doc:sanitize_position(line: any, col: any)
-> integer
2. number

sanitize_selection

(method) core.doc:sanitize_selection()

save

(method) core.doc:save(filename: any, abs_filename: any)

select_to

(method) core.doc:select_to(...any)

select_to_cursor

(method) core.doc:select_to_cursor(idx: any, ...any)

set_filename

(method) core.doc:set_filename(filename: any, abs_filename: any)

set_selection

(method) core.doc:set_selection(line1: any, col1: any, line2: any, col2: any, swap: any)

set_selections

(method) core.doc:set_selections(idx: any, line1: any, col1: any, line2: any, col2: any, swap: any, rm: any)

text_input

(method) core.doc:text_input(text: any, idx: any)

undo

(method) core.doc:undo()

widget.textbox.SingleLineHighlighter

Customized Highlighter to disable the coroutine.

get_line

(method) widget.textbox.SingleLineHighlighter:get_line(idx: any)
-> table

start

(method) widget.textbox.SingleLineHighlighter:start()

widget.textbox.TextView

__index

(field) __index: core.object

cache_font

(field) cache_font: unknown

cache_font_size

(field) cache_font_size: unknown

cache_indent_size

(field) cache_indent_size: unknown

context

(field) context: string

current_scale

(field) current_scale: number

cursor

(field) cursor: string

doc

(field) doc: any

font

(field) font: string

gutter_text_brightness

(field) gutter_text_brightness: integer

gutter_width

(field) gutter_width: integer

h_scrollbar

(field) h_scrollbar: core.scrollbar

Scrollbar Use Scrollbar:set_size to set the bounding box of the view the scrollbar belongs to. Use Scrollbar:update to update the scrollbar animations. Use Scrollbar:draw to draw the scrollbar. Use Scrollbar:on_mouse_pressed, Scrollbar:on_mouse_released, Scrollbar:on_mouse_moved and Scrollbar:on_mouse_left to react to mouse movements; the scrollbar won't update automatically. Use Scrollbar:set_percent to set the scrollbar location externally.

To manage all the orientations, the scrollbar changes the coordinates system accordingly. The "normal" coordinate system adapts the scrollbar coordinates as if it's always a vertical scrollbar, positioned at the end of the bounding box.


hide_lines_gutter

(field) hide_lines_gutter: boolean

hovered_scrollbar

(field) hovered_scrollbar: boolean

hovering_gutter

(field) hovering_gutter: boolean

ime_selection

(field) ime_selection: table

ime_status

(field) ime_status: boolean

label

(field) label: string

last_col1

(field) last_col1: unknown

last_col2

(field) last_col2: unknown

last_line1

(field) last_line1: unknown

last_line2

(field) last_line2: unknown

last_x_offset

(field) last_x_offset: table

mouse_selecting

(field) mouse_selecting: unknown

name

(field) name: string

parent

(field) parent: any

position

(field) position: core.view.position

scroll

(field) scroll: core.view.scroll

scrollable

(field) scrollable: boolean

size

(field) size: core.view.position

super

(field) super: core.docview

translate

(field) translate: table

v_scrollbar

(field) v_scrollbar: core.scrollbar

Scrollbar Use Scrollbar:set_size to set the bounding box of the view the scrollbar belongs to. Use Scrollbar:update to update the scrollbar animations. Use Scrollbar:draw to draw the scrollbar. Use Scrollbar:on_mouse_pressed, Scrollbar:on_mouse_released, Scrollbar:on_mouse_moved and Scrollbar:on_mouse_left to react to mouse movements; the scrollbar won't update automatically. Use Scrollbar:set_percent to set the scrollbar location externally.

To manage all the orientations, the scrollbar changes the coordinates system accordingly. The "normal" coordinate system adapts the scrollbar coordinates as if it's always a vertical scrollbar, positioned at the end of the bounding box.


__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) core.docview:__tostring()
-> string

clamp_scroll_position

(method) core.view:clamp_scroll_position()

draw

(method) widget.textbox.TextView:draw()

Overwrite this function just to disable the core.push_clip_rect


draw_background

(method) core.view:draw_background(color: renderer.color)

draw_caret

(method) core.docview:draw_caret(x: any, y: any, line: any, col: any)

draw_ime_decoration

(method) core.docview:draw_ime_decoration(line1: any, col1: any, line2: any, col2: any)

draw_line_body

(method) core.docview:draw_line_body(line: any, x: any, y: any)
-> integer

draw_line_gutter

(method) widget.textbox.TextView:draw_line_gutter(idx: any, x: any, y: any)

draw_line_highlight

(method) widget.textbox.TextView:draw_line_highlight()

draw_line_text

(method) core.docview:draw_line_text(line: any, x: any, y: any)
-> integer

draw_overlay

(method) core.docview:draw_overlay()

draw_scrollbar

(method) core.view:draw_scrollbar()

extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


get_col_x_offset

(method) core.docview:get_col_x_offset(line: any, col: any)
-> integer|unknown

get_content_bounds

(method) core.view:get_content_bounds()
-> number
2. number
3. number
4. number

get_content_offset

(method) core.view:get_content_offset()
-> x: number
2. y: number

get_filename

(method) core.docview:get_filename()
-> string|unknown

get_font

(method) core.docview:get_font()
-> unknown

get_gutter_width

(method) widget.textbox.TextView:get_gutter_width()
-> integer

get_h_scrollable_size

(method) core.docview:get_h_scrollable_size()
-> number

get_line_height

(method) widget.textbox.TextView:get_line_height()
-> integer

get_line_screen_position

(method) core.docview:get_line_screen_position(line: any, col: any)
-> unknown
2. unknown

get_line_text_y_offset

(method) core.docview:get_line_text_y_offset()
-> unknown

get_name

(method) widget.textbox.TextView:get_name()
-> string

get_scrollable_size

(method) widget.textbox.TextView:get_scrollable_size()
-> integer

get_text

(method) widget.textbox.TextView:get_text()

get_visible_line_range

(method) core.docview:get_visible_line_range()
-> integer
2. integer

get_x_offset_col

(method) core.docview:get_x_offset_col(line: any, x: any)
-> integer

is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


mouse_selection

(method) core.docview:mouse_selection(doc: any, snap_type: any, line1: any, col1: any, line2: any, col2: any)
-> unknown
2. integer|unknown
3. unknown
4. integer|unknown

move_towards

(method) core.view:move_towards(t: any, k: any, dest: any, rate: any, name: any)

new

(method) widget.textbox.TextView:new(parent: any)

on_file_dropped

(method) core.view:on_file_dropped(filename: string, x: number, y: number)
-> boolean

on_ime_text_editing

(method) core.docview:on_ime_text_editing(text: any, start: any, length: any)

on_mouse_left

(method) core.view:on_mouse_left()

on_mouse_moved

(method) core.docview:on_mouse_moved(x: number, y: number, ...any)

on_mouse_pressed

(method) core.docview:on_mouse_pressed(button: 'left'|'right', x: number, y: number, clicks: integer)
-> boolean|nil

on_mouse_released

(method) core.docview:on_mouse_released(...any)

on_mouse_wheel

(method) core.view:on_mouse_wheel(y: number, x: number)
-> boolean

@param y — Vertical scroll delta; positive is "up"

@param x — Horizontal scroll delta; positive is "left"

@return — Capture event


on_scale_change

(method) core.view:on_scale_change(new_scale: number, prev_scale: number)

Can be overriden to listen for scale change events to apply any neccesary changes in sizes, padding, etc...


on_text_input

(method) core.docview:on_text_input(text: string)

on_touch_moved

(method) core.view:on_touch_moved(x: number, y: number, dx: number, dy: number, i: number)

resolve_screen_position

(method) core.docview:resolve_screen_position(x: any, y: any)
-> number
2. integer

scroll_to_line

(method) core.docview:scroll_to_line(line: any, ignore_if_visible: any, instant: any)

scroll_to_make_visible

(method) core.docview:scroll_to_make_visible(line: any, col: any)

scrollbar_dragging

(method) core.view:scrollbar_dragging()
-> boolean

scrollbar_hovering

(method) core.view:scrollbar_hovering()
-> boolean

scrollbar_overlaps_point

(method) core.view:scrollbar_overlaps_point(x: number, y: number)
-> boolean

set_text

(method) widget.textbox.TextView:set_text(text: any, select: any)

supports_text_input

(method) core.docview:supports_text_input()
-> boolean

try_close

(method) core.docview:try_close(do_close: any)

update

(method) core.docview:update()

update_ime_location

(method) core.docview:update_ime_location()

Update the composition bounding box that the system IME will consider when drawing its interface


update_scrollbar

(method) core.view:update_scrollbar()

override_rootview

function widget.override_rootview()

Called when initializing a floating widget to generate RootView overrides, this function will only override the events once.


__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) widget:__tostring()
-> string

Useful for debugging.


activate

(method) widget.textbox:activate()

add_child

(method) widget:add_child(child: widget)

Add a child widget, automatically assign a zindex if non set and sorts them in reverse order for better events matching.


animate

(method) widget:animate(target?: table, properties: table<string, number>, options?: widget.animation.options)

Registers a new animation to be ran on the update cycle.

@param target — If nil assumes properties belong to widget it self.


capture_mouse

(method) widget:capture_mouse(scrolling?: boolean)

All mouse events will be directly sent to the widget even if mouse moves outside the widget region.

@param scrolling — Capture for scrolling


centered

(method) widget:centered()

Center the widget horizontally and vertically to the screen or parent widget.


clamp_scroll_position

(method) core.view:clamp_scroll_position()

deactivate

(method) widget.textbox:deactivate()

destroy

(method) widget:destroy()

If floating, remove the widget from the floating widgets list to allow proper garbage collection.


destroy_childs

(method) widget:destroy_childs()

Recursively destroy all childs from the widget.


drag

(method) widget:drag(x: number, y: number)

Used internally when dragging is activated.


draw

(method) widget.textbox:draw()
-> boolean

draw_background

(method) core.view:draw_background(color: renderer.color)

draw_border

(method) widget:draw_border(x?: number, y?: number, w?: number, h?: number)

Draw the widget configured border or custom one.


draw_scrollbar

(method) widget:draw_scrollbar()

draw_styled_text

(method) widget:draw_styled_text(text: table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>, x: integer, y: integer, only_calc?: boolean, start_idx?: integer, end_idx?: integer)
-> width: integer
2. height: integer

Render or calculate the size of the specified range of elements in a styled text elemet.


draw_text_multiline

(method) widget:draw_text_multiline(font: string|renderer.font|widget.fontreference, text: string, x: integer, y: integer, color: renderer.color, only_calc: boolean)
-> resx: integer
2. resy: integer
3. width: integer
4. height: integer

Taken from the logview and modified it a tiny bit. TODO: something similar should be on pragtical core.


extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


force_event

(method) widget:force_event(name: "mouse_released", force: boolean)

Toggle the forced interception of given event even if all the conditions for emitting it are not met.

Note: only "mouse_released" is implemented for the moment on floating views for use in the SelectBox, maybe a better system can be implemented on the future.

@param force — If omitted is set to true by default

name:
| "mouse_released"

get_bottom

(method) widget:get_bottom()
-> number

Get the bottom y coordinate relative to parent


get_content_bounds

(method) core.view:get_content_bounds()
-> number
2. number
3. number
4. number

get_content_offset

(method) core.view:get_content_offset()
-> x: number
2. y: number

get_font

(method) widget:get_font(font?: string|renderer.font|widget.fontreference)
-> renderer.font

Get the real renderer.font associated with a widget.font.


get_h_scrollable_size

(method) widget:get_h_scrollable_size()
-> number

Calculates the x scrollable size taking into account the right most widget or the size of the widget it self if greater.


get_height

(method) widget:get_height()
-> number

Get height including borders.


get_name

(method) widget:get_name()
-> string

The name that is displayed on pragtical tabs.


get_position

(method) widget:get_position()
-> widget.position

Get the relative position in relation to parent


get_real_height

(method) widget:get_real_height()
-> number

Overall height of the widget accounting all visible child widgets.


get_real_width

(method) widget:get_real_width()
-> number

Overall width of the widget accounting all visible child widgets.


get_right

(method) widget:get_right()
-> number

Get the right x coordinate relative to parent


get_scrollable_size

(method) widget:get_scrollable_size()
-> number

Calculates the y scrollable size taking into account the bottom most widget or the size of the widget it self if greater.


get_size

(method) widget:get_size()
-> widget.position

get_text

(method) widget.textbox:get_text()
-> string

Get the text displayed on the textbox.


get_width

(method) widget:get_width()
-> number

Get width including borders.


hide

(method) widget:hide()

Hide the widget.


hide_animated

(method) widget:hide_animated(lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)

Perform an animated hide.

@param lock_x — Do not resize width while animating

@param lock_y — Do not resize height while animating


is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


is_visible

(method) widget:is_visible()
-> boolean

Check if the widget is visible also recursing to the parent visibility.


mouse_on_top

(method) widget:mouse_on_top(x: number, y: number)
-> boolean

Check if the given mouse coordinate is hovering the widget


move_towards

(method) core.view:move_towards(t: any, k: any, dest: any, rate: any, name: any)

new

(method) widget.textbox:new(parent: widget, text: boolean, placeholder: any)

on_change

(method) widget:on_change(value: any)

Event emitted when the value of the widget changes. If applicable, child widgets should call this method when its value changes.


on_click

(method) widget:on_click(button: "left"|"right", x: number, y: number)

Click event emitted on a succesful on_mouse_pressed and on_mouse_released events combo.

button:
| "left"
| "right"

on_file_dropped

(method) widget:on_file_dropped(filename: string, x: number, y: number)
-> processed: boolean

Send file drop event to hovered child.


on_ime_text_editing

(method) core.view:on_ime_text_editing(text: any, start: any, length: any)

on_mouse_enter

(method) widget:on_mouse_enter(x: any, y: any, dx: any, dy: any)

Emitted once when the mouse hovers the widget.


on_mouse_leave

(method) widget:on_mouse_leave(x: any, y: any, dx: any, dy: any)

Emitted once when the mouse leaves the widget.


on_mouse_left

(method) widget:on_mouse_left()

on_mouse_moved

(method) widget.textbox:on_mouse_moved(x: number, y: number, dx: number, dy: number)
-> boolean

on_mouse_pressed

(method) widget.textbox:on_mouse_pressed(button: "left"|"right", x: number, y: number, clicks: integer)
-> boolean

on_mouse_released

(method) widget.textbox:on_mouse_released(button: "left"|"right", x: number, y: number)
-> boolean

on_mouse_wheel

(method) widget:on_mouse_wheel(y: number, x: number)
-> boolean

on_scale_change

(method) widget:on_scale_change(new_scale: number, prev_scale: number)

Can be overriden by widgets to listen for scale change events to apply any neccesary changes in sizes, padding, etc...


on_text_change

(method) widget.textbox:on_text_change(action: string, ...any)

Event fired on any text change event.

@param action — Can be "insert" or "remove",

insert arguments (see Doc:raw_insert): line, col, text, undo_stack, time remove arguments (see Doc:raw_remove): line1, col1, line2, col2, undo_stack, time


on_text_input

(method) widget.textbox:on_text_input(text: string)

on_touch_moved

(method) core.view:on_touch_moved(x: number, y: number, dx: number, dy: number, i: number)

release_mouse

(method) widget:release_mouse()

Undo capture_mouse()


remove_child

(method) widget:remove_child(child: widget)

Remove a child widget.


run_animations

(method) widget:run_animations()

Runs all registered animations removing duplicated and finished ones.


schedule_update

(method) widget:schedule_update()

Schedule a core update and redraw. Since widgets try to not fire updates and draws to child widgets to reduce cpu consumption this function can be used when a re-update and re-draw is strictly needed.


scrollbar_dragging

(method) core.view:scrollbar_dragging()
-> boolean

scrollbar_hovering

(method) core.view:scrollbar_hovering()
-> boolean

scrollbar_overlaps_point

(method) core.view:scrollbar_overlaps_point(x: number, y: number)
-> boolean

set_border_width

(method) widget:set_border_width(width: integer)

Set the widget border size and appropriately re-set the widget size.


set_label

(method) widget:set_label(text: string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>)

A text label for the widget, not all widgets support this.


set_position

(method) widget:set_position(x?: integer, y?: integer)

Set the position of the widget and updates the child absolute coordinates


set_size

(method) widget.textbox:set_size(width: integer)

set_target_size

(method) widget:set_target_size(axis: string|'x'|'y', value: number)
-> boolean

Called by pragtical node system to properly resize the widget.

axis:
| 'x'
| 'y'

set_text

(method) widget.textbox:set_text(text: string, select?: boolean)

Set the text displayed on the textbox.


set_tooltip

(method) widget:set_tooltip(tooltip?: string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>, command?: string)

Text displayed when the widget is hovered. If a command name is also given its associated binding will be displayed as part of the tooltip.


show

(method) widget:show()

Show the widget.


show_animated

(method) widget:show_animated(lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)

Perform an animated show.

@param lock_x — Do not resize width while animating

@param lock_y — Do not resize height while animating


supports_text_input

(method) core.view:supports_text_input()
-> boolean

swap_active_child

(method) widget:swap_active_child(child?: widget)

Replaces current active child with a new one and calls the activate/deactivate events of the child. This is especially used to send text input events to widgets with input_text support.

@param child — If nil deactivates current child


toggle_background

(method) widget:toggle_background(enable?: boolean)

When set to false the background rendering is disabled.


toggle_visible

(method) widget:toggle_visible(animated?: boolean, lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)

Toggle visibility of widget.


try_close

(method) core.view:try_close(do_close: any)

update

(method) widget.textbox:update()
-> boolean

update_if_scaled

(method) widget:update_if_scaled()

Explicitly call the widget update procedure when the scale change even if the widget is not visible.


update_position

(method) widget:update_position()

Called on the update function to be able to scroll the child widgets.


update_scrollbar

(method) core.view:update_scrollbar()

update_size_position

(method) widget:update_size_position()

Similar to update, but here you should perform expensive calculations that will get executed for a predefined period of time when a widget is initialized, scale has changed or a widget switched from hidden to visible.