You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
SpinBox focus mode does not work as expected.
Setting the focus mode to None does not disable the focus mode of the internal LineEdit used by the node.
Some hacky script workaround on the SpinBox is required to prevent this.
(The reason this is an issue for my project is that the user needs full use of the keyboard to press buttons on the synthesizer keyboard. If the spinbox button is pressed with the mouse, it auto-focuses and causes keyboard to type in the built-in LineEdit which is not desired behavior.)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add an option to the inspector to disable the line edit focus.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
TBD
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be done but I haven't found an elegant solution yet.
The grab_focus() method can't be overriden.
Setting the line focus mode to None results in an warning.
So there is something internal to the SpinBox node that is doing this.
I used a combination of changing the focus style and releasing focus after text or value change.
But it's not perfect. Clicking the arrows even when they are disabled pulses the line edit.
Perhaps instead of a LineEdit, I'd be better off with a Label and two buttons.
I tried setting Editable to false, but that just makes it so it can't be changed at all (even via the buttons.)
I just don't want to be able to focus the text field. But the spin box auto-focuses the text field even if focus mode is disabled on the spin box.
extendsSpinBoxconstNORMAL_LINEEDIT_STYLE=preload("res://normal_lineedit_style.tres")
@onreadyvarline=get_line_edit()
func_ready():
# Ensure SpinBox itself can't grab focusfocus_mode=Control.FOCUS_NONE# line.focus_mode = Control.FOCUS_NONE# line.mouse_filter = Control.MOUSE_FILTER_IGNORE # Prevent mouse clicks from selecting it# Remove focus border from internal line editline.add_theme_stylebox_override("focus", NORMAL_LINEEDIT_STYLE)
# Remove focus from LineEdit after it grabs itline.text_changed.connect(_on_text_changed)
self.value_changed.connect(_on_value_changed)
func_on_text_changed(_new_text):
line.release_focus()
func_on_value_changed(_value):
line.release_focus()
Is there a reason why this should be core and not an add-on in the asset library?
Core function of SpinBox / LineEdit
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
A synthesizer tool
Describe the problem or limitation you are having in your project
SpinBox focus mode does not work as expected.
Setting the focus mode to None does not disable the focus mode of the internal LineEdit used by the node.
Some hacky script workaround on the SpinBox is required to prevent this.
(The reason this is an issue for my project is that the user needs full use of the keyboard to press buttons on the synthesizer keyboard. If the spinbox button is pressed with the mouse, it auto-focuses and causes keyboard to type in the built-in LineEdit which is not desired behavior.)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add an option to the inspector to disable the line edit focus.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
TBD
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be done but I haven't found an elegant solution yet.
The grab_focus() method can't be overriden.
Setting the line focus mode to None results in an warning.
So there is something internal to the SpinBox node that is doing this.
I used a combination of changing the focus style and releasing focus after text or value change.
But it's not perfect. Clicking the arrows even when they are disabled pulses the line edit.
Perhaps instead of a LineEdit, I'd be better off with a Label and two buttons.
I tried setting Editable to false, but that just makes it so it can't be changed at all (even via the buttons.)
I just don't want to be able to focus the text field. But the spin box auto-focuses the text field even if focus mode is disabled on the spin box.
Is there a reason why this should be core and not an add-on in the asset library?
Core function of SpinBox / LineEdit
The text was updated successfully, but these errors were encountered: