This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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():
    newTile._init3(spawnpoint,num,Color( 0.75, 0.75, 0.75, 3))
    newTile.add_color_override("font_color",Color( 0.75, 0.75, 0.75, 3))
    var stylebox_flat :=
    stylebox_flat.bg_color =Color(1, 1, 1, 1)
    newTile.add_stylebox_override("normal", stylebox_flat)


func _init3(_spawnpoint:Vector2,_num:int,_ntcolour:Color):

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

but Godot ignored that. How to disable the hover or mouse enter signal ? 
Godot version 3.3.4
in Engine by (54 points)
edited by

1 Answer

–1 vote

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

by (1,406 points)

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

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 :=
        $Button.add_stylebox_override("normal", stylebox_flat)
        $Button.add_stylebox_override("hover", stylebox_flat)
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 Frequently asked questions and 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 [email protected] with your username.