TextureButton need some help

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

The button has some options for toggle, but no way to look at the variable which uses that information, it would be great to have that as a property to mess around, tried to find the documento and whatever was written there did not help me at all.
I did get around using disable the button.
I am trying to get inputs on the button from left mouse click and right mouse click.
With the left it will use the internal way of how the button works, it is fine.
And using the right button have to use another signal which tests for event, up until here is all good.
The problem is how to controle the inputs on the button. You see disabling it would be the way to go but that is used internally to change the appearance of the button according to the textures set to it, the really big problem with this is that is reset to the first texture available in the list if the disable textures is not set. Either way it will chose a texture to present itself when disable, it will not maintain the current texture, which if it did then will not be hitting a wall here.
So need for example to right click the button and change an animated frame on topo of it but when I do that the button must be disable until I toggle that frame away.
The button would have just 2 textures, one for when it is no been pressed or toggle off, and the other one for been pressed or toggle on. But how the disable mess things out I need to provide a texture for disable, which is used when the button is toggle on, to create the effect to pressed it and keep pressed until something else happens, blocking the player the ability to keep toggling it on and off.
So when button is pressed it keeps that way, and to prevent the player to undo the press I disable it. without the texture for disable state it will reset the button to the unpressed state, now I am not sure if the internal state of the button is pressed or not when it is disable, which disabling it should not reset or change the current sate, because it does mess with the button and it has no way to feed back its internal state it is really hard to do some cool stuff. yes just because of this little detail.
Maybe I am having the wrong approach to the matter. And having hard time to figure how to do it.
using another signal for input detection solves the use of a diferente button to put some mark on the button. But trying to use disable on the button also will not detect this event of the right click.
this disable should be a button thing and not a node things.
The way the texturebutton is, it kind of gives the impression that the disable state is not a node state , so it should only work for the settings inputs available to it and not to the event of other inputs outside the button function.
Then I cannot really block the player input because doing so will change the texture to only one possible way which I don’t have much control of it, because I need it to be at the current texture which is on.
Either way, I was just trying to use the buttons feature trying to keep implementation at minimum. And that made me realize how some details about the texturebutton makes it somewhat limited depending on what you are trying to do.
I know to circle around this by creating a variable state to controle which click does what and when , but again, no feed back from the texture button to do this properly, couldn’t find any anyways.
All I need is a way to know in which state the button is, of course is about toggle.
In the documentation there is no property like toggle, to look at it, I am not trying to change the mode from toggle and press mode, I am trying to access the variable which tells me if the button is been pressed, it does not matter the mode, the variable which holds that information should be just one, used in both modes.
As the player could be holding down the click on a button so the state will evaluate as been pressed, which visually is what the button does. same thing works just fine visually for toggle mode. But where the hell is this variable?
also the variable in question if changed should change the visual accordingly. So some nice stuff could be done that way too from code.

need to add another problem with the node texturebutton
hte use of gui_input signal makes the button to be pressed, visually, it is like I am pressing it as if usng the option to activate the button to be used in the button mechanics.
See there are 3 options there, left click, right click and middle click, as a effective click which will make the button move and act like a button. This is ok.
What is not is when using other mechanics outside of that, and it still make the button act like a button it just visually. It should not do that.

Summary things.
Too many problems that generates conflict of use and affect how flexible the button can be used:

  • disable affect the whole node instead of only the button internal functionality.
  • gui_event messes with the button functionally even though it is a control inheritance and should not get into the button mechanic.

another whey to solve this would be to have inputevent passed by the signal used to dected clicks on the button. but the problem here is that the visual function of the button is a blackbox and as soon we use any input detection with any signal it will fire the animation of the button.

The button should be revised and fixed to give all the flexibility it could give.
Like I said one of the thing it should do is to make sure disable only affects the internal mechanic of the button but saving the current state the button is in and resuming it when it is enabled again.
the other thing is that the signal gui_event should not interact with the button mechanics. And that is it. will solve most of the problem just doing this.

so what do you want the button to do

Finally got it working.
Basically just not using the signais from the texturebutton regarding the cliques states, all of that does not give you control over the state of the button visually speaking with what you need them to do.
So another thing to emphasize is that the texturebutton has property inheritance from node control or node, does not matter, the atribute is to pass mouse event forward and it is set by default for the texturebutton to stop, so it block the input. but this is only a thing I guess, if you wanna add another area of detection, like area2d.

any way, the solution is not to use the signal like button_up and such.
and you need to use gui_event(I think what is called)
by this evente you can pass the event and filter which button is clicked, then yeah you have to essencially build everything that testes the mouse over using the signal mosue enter and mouse exited. and a variable bool for the second button state.
the use of the internal button_pressed is what you will use for detecting if the button is pressed or not, and used to set the stated of the button so it will visually change accordingly.

Can’t use disable. and can’t use the pre made signals for button presses. That is the secrete.