How to disable click acceptance for texture button?

godot 4.

how to disable click acceptance for texture button?

in a regular button, this is button.disabled, how to do this with texture button?

I tried texture_button, texturebutton, its not work…

The TextureButton inherits all properties from BaseButton, so the it also has the disabled property, that you can change in the same way as with regular buttons.

and how to disable this property? what line?

You write, that you can disable regular buttons by changing button.disabled.
With button you access the button node; with .disabled you access the property.

With a texture button, the process is the same.

How do you define button in the line above?
Possibly like this @onready var button = $Button

You would have to adjust it like this: @onready var button = $TextureButton, depending on the name of the node, that you give the texture button.

That’s how I did it, it doesn’t work for me name.button.disabled = true / false

The following works for me:

@onready var button = $TextureButton

func _on_check_button_toggled(toggled_on: bool) -> void:
	button.disabled = toggled_on

If you could share your code, then then the problem might be more easy to identify.

@onready var quitb = $Quit

pressing the initial button in the menu

func _on_quit_pressed():
quitbutton.position.x = 575
quitbutton.position.y = 400

there should be a restriction on accepting clicks of the initial button

teleport the exit confirmation window

———

canceling the exit in the confirmation window

func _on_nquit_pressed():
quitbutton.position.x = 5000
quitbutton.position.y = 5000

access to the buttons should be opened

Please make sure to correctly format source code. You could use the “</>” button of the edit-field for that.

Here are a few things, I have noticed:

  • You don’t seem to define quitbutton anywhere in your code, but instead quitb.
  • There seems to be no code to disable the button?!
  • instead of moving the position offscreen by setting it to 5000, alternatively you could hide the node. See CanvasItem.visible.
1 Like

</> 123 </>

1 It’s there, I just cut it out
2 ???
3 ok

kakzhe menya zaebal godot

I meant the </> button above the text (6th button from the left in this screenshot of the web interface) and not inserting “</>”:
image

  1. You do realize, that leaving important things out will make it difficult to help you.
  2. In your code, you never set quitbutton.disabled = true.