diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-07-17 17:44:13 +0200 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2020-07-26 20:06:07 +0200 |
commit | 8c05dadcffbd31c4faeb09d222da0d3ca07c5ab0 (patch) | |
tree | 9c6a778c1428a49b33f1fa274e5e94802a029852 /doc/classes | |
parent | 33d423e240fbfa0b28bfa40fd0be746e88e95a31 (diff) |
Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.
Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.
Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.
Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/DisplayServer.xml | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 49af8d7de2..814c232668 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -627,12 +627,14 @@ <return type="int"> </return> <description> + Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden. </description> </method> <method name="virtual_keyboard_hide"> <return type="void"> </return> <description> + Hides the virtual keyboard if it is shown, does nothing otherwise. </description> </method> <method name="virtual_keyboard_show"> @@ -642,13 +644,23 @@ </argument> <argument index="1" name="position" type="Rect2" default="Rect2i( 0, 0, 0, 0 )"> </argument> - <argument index="2" name="max_length" type="int" default="-1"> + <argument index="2" name="multiline" type="bool" default="false"> </argument> - <argument index="3" name="cursor_start" type="int" default="-1"> + <argument index="3" name="max_length" type="int" default="-1"> </argument> - <argument index="4" name="cursor_end" type="int" default="-1"> + <argument index="4" name="cursor_start" type="int" default="-1"> + </argument> + <argument index="5" name="cursor_end" type="int" default="-1"> </argument> <description> + Shows the virtual keyboard if the platform has one. + [code]existing_text[/code] parameter is useful for implementing your own [LineEdit] or [TextEdit], as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions). + [code]position[/code] parameter is the screen space [Rect2] of the edited text. + [code]multiline[/code] parameter needs to be set to [code]true[/code] to be able to enter multiple lines of text, as in [TextEdit]. + [code]max_length[/code] limits the number of characters that can be entered if different from [code]-1[/code]. + [code]cursor_start[/code] can optionally define the current text cursor position if [code]cursor_end[/code] is not set. + [code]cursor_start[/code] and [code]cursor_end[/code] can optionally define the current text selection. + [b]Note:[/b] This method is implemented on Android, iOS and UWP. </description> </method> <method name="vsync_is_enabled" qualifiers="const"> |