This is possible, but it's harder than it should be. There's something unexpected (to me) about how the _Input(InputEvent @event)
function is called. It appears to be always called, even when it seems like another Control should have handled the event. To work around this I added a mouse cursor position check.
Add a script to your Button
that tells Godot that the mouse pressed event has been handled. Example in C#:
public override void _Input(InputEvent @event) {
if(@event is InputEventMouseButton) {
InputEventMouseButton mouseEvent = @event as InputEventMouseButton;
if(mouseEvent.Pressed && GetGlobalRect().HasPoint(mouseEvent.GlobalPosition)) {
GetViewport().SetInputAsHandled();
}
}
}