From 8c05dadcffbd31c4faeb09d222da0d3ca07c5ab0 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Fri, 17 Jul 2020 17:44:13 +0200 Subject: 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. --- doc/classes/DisplayServer.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'doc/classes') 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 @@ + Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden. + Hides the virtual keyboard if it is shown, does nothing otherwise. @@ -642,13 +644,23 @@ - + - + - + + + + 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. -- cgit v1.2.3