How to disable hover over mouse

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cloa513

I created a button and it switches to the wrong image when the mouse is on it. It is GODOT default action. I tried

func _pressed():
	var newTile=Button.new()
	newTile.set_script(nT)
	newTile.visible=false
	get_parent().add_child(newTile)
	newTile.rect_min_size=Vector2(75,75)
	spawnpoint=spawnlocn-Vector2(25,25)
	newTile._init3(spawnpoint,num,Color( 0.75, 0.75, 0.75, 3))
	newTile.set_global_position(spawnpoint)
	newTile.text=str(num)
	newTile.add_color_override("font_color",Color( 0.75, 0.75, 0.75, 3))
	var stylebox_flat := StyleBoxFlat.new()
	stylebox_flat.bg_color =Color(1, 1, 1, 1)
	newTile.add_stylebox_override("normal", stylebox_flat)

	newTile.visible=true

func _init3(_spawnpoint:Vector2,_num:int,_ntcolour:Color):
	sp=_spawnpoint
	num=_num
	c=_ntcolour
	connect("focus_entered",self,"disablefocus")

func disablefocus():
	text=str(num)
	add_color_override("font_color",Color( 0.75, 0.75, 0.75, 3))
	var stylebox_flat := StyleBoxFlat.new()
	stylebox_flat.bg_color =c
	add_stylebox_override("normal", stylebox_flat)

but Godot ignored that. How to disable the hover or mouse enter signal ? 
:bust_in_silhouette: Reply From: spaceyjase

Override the style/theme with the desired image. That is, set the hover image to the same as !hover, if that makes sense.

Isn’t that what I set in the code above?- yet it made no difference.

cloa513 | 2021-11-17 14:40

You code connects a function to focus enter so doesn’t prevent anything. You can’t stop the signals, just don’t respond to them. Ideally you should be changing code to configure something like this in _ready. You are also only setting the "normal" style.

This works:

  func _ready()
        var stylebox_flat := StyleBoxFlat.new()
        $Button.add_stylebox_override("normal", stylebox_flat)
        $Button.add_stylebox_override("hover", stylebox_flat)

spaceyjase | 2021-11-17 15:13