0 votes

Hi I have a Scroll Container with a vboxcontainer inside, and inside of this vboxcontiner I have a lot of touchscreen buttons.
The problem is that when I add a lot of touchscreen buttons, and the scrollbar is visible, you can touch the buttons that are not visible, so I need to block signals from buttons that are not visible from Scroll container, but I don’t know how to do that because Scroll Container has a few properties.

in Engine by (131 points)

you can set the button to disabled if you don't want to make it clickable. is that what you mean?

No, just figured out that is a bug from Godot

1 Answer

–1 vote
Best answer

Hmm i really like your question made me think for a second.

I know with TextureButton there exists a disable property but with TouchScreenButtons you might have to set _input to false. also TextureButton has the _gui_input() signal which guarantees only that button is being pressed

But if it must be a TouchScreenButton first connect the on_scroll started/exited signal to a script:

func _on_ScrollContainer_scroll_ended():
    var box = Rect2(rect_global_position, rect_size)
    for child in $VBoxContainer.get_children():
        var centre_point = child.global_position + (TouchScreenButtonSize / 2)
        if !box.has_point(centre_point):
            child.set_process_input(false)
        else:
            child.set_process_input(true)
by (3,290 points)
selected by

Thanks, that worked, but I figured out that is a bug from Godot, if you change the touchscreen buttons to buttons, this problem is solved, so for some bug reason Touchscreen buttons that are not visible inside of a Scroll container can be pressed.
Solution: change to buttons or make this script, thanks man!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.