Skip to content

Add option to change virtual keyboard type for all text input nodes #104171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

syntaxerror247
Copy link
Member

@syntaxerror247 syntaxerror247 commented Mar 15, 2025

Closes godotengine/godot-proposals#11996 and closes godotengine/godot-proposals#7449

  • Added option to change virtual keyboard type in TextEdit and CodeEdit.
  • Set virtual keyboard type default to KEYBOARD_TYPE_NUMBER_DECIMAL for SpinBox.

@syntaxerror247 syntaxerror247 added this to the 4.5 milestone Mar 15, 2025
@syntaxerror247 syntaxerror247 requested a review from a team March 15, 2025 10:06
@syntaxerror247 syntaxerror247 requested review from a team as code owners March 15, 2025 10:06
@syntaxerror247 syntaxerror247 force-pushed the virtual-keyboard-type branch from 4d6fdcb to 30d2b3f Compare March 15, 2025 10:10
@syntaxerror247 syntaxerror247 changed the title Add option to change virtual keyboard type for all text input nodes Android: Add option to change virtual keyboard type for all text input nodes Mar 15, 2025
@syntaxerror247 syntaxerror247 changed the title Android: Add option to change virtual keyboard type for all text input nodes Add option to change virtual keyboard type for all text input nodes Mar 16, 2025
@syntaxerror247 syntaxerror247 force-pushed the virtual-keyboard-type branch 2 times, most recently from 726ac83 to ebf4454 Compare March 16, 2025 11:50
@syntaxerror247
Copy link
Member Author

Just to make it clear, this PR is ready for review.

@Alex2782
Copy link
Member

Alex2782 commented Mar 17, 2025

Test project: test_input_virtual.zip

The tests on 2 devices were ok. (Google Pixel smartphone and Samsung tablet)


Can LineEdit from SpinBox also be displayed in the Inspector?

Details
%SpinBox.get_line_edit().virtual_keyboard_enabled
%SpinBox.get_line_edit().virtual_keyboard_type

Bildschirmfoto 2025-03-17 um 01 45 10


Maybe like editable.

(a clean solution would probably be inheritance, C++ allows multiple inheritance, but only one class can be passed to GDCLASS, I think)

class SpinBox : public Range {
	GDCLASS(SpinBox, Range);

	LineEdit *line_edit = nullptr;

---------

void SpinBox::set_editable(bool p_enabled) {
	line_edit->set_editable(p_enabled);
	queue_redraw();
}

image

@syntaxerror247
Copy link
Member Author

syntaxerror247 commented Mar 17, 2025

Test project: test_input_virtual.zip

The tests on 2 devices were ok. (Google Pixel smartphone and Samsung tablet)


Can LineEdit from SpinBox also be displayed in the Inspector?

Details
%SpinBox.get_line_edit().virtual_keyboard_enabled
%SpinBox.get_line_edit().virtual_keyboard_type

Bildschirmfoto 2025-03-17 um 01 45 10


Maybe like editable.

(a clean solution would probably be inheritance, C++ allows multiple inheritance, but only one class can be passed to GDCLASS, I think)

class SpinBox : public Range {
	GDCLASS(SpinBox, Range);

	LineEdit *line_edit = nullptr;

---------

void SpinBox::set_editable(bool p_enabled) {
	line_edit->set_editable(p_enabled);
	queue_redraw();
}

image

We can do something like editable. I just didn't exposed it to inspector as there is no need to change the keyboard type to anything other than number for SpinBox.

@syntaxerror247 syntaxerror247 force-pushed the virtual-keyboard-type branch from ebf4454 to 0d629f8 Compare March 17, 2025 09:11
@syntaxerror247 syntaxerror247 force-pushed the virtual-keyboard-type branch from 0d629f8 to a23acbb Compare March 17, 2025 09:28
@syntaxerror247 syntaxerror247 marked this pull request as draft March 17, 2025 12:03
@syntaxerror247
Copy link
Member Author

I encountered an issue where, the keyboard type for TextEdit switches to multiline keyboard after submitting/pressing enter, instead of retaining the specified keyboard type. I'm marking this as a draft until I resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TextEdit.virtual_keyboard_type like LineEdit.virtual_keyboard_type allow for other types virtual keyboards on more than just line edit
4 participants