[SOLVED] What blocks GUI buttons?

Started by Tamanegi, Tue 01/02/2011 04:31:45

Previous topic - Next topic

Tamanegi

Okay, this may be a strange question, but what could be blocking a GUI button from being clicked? Because I have a button, and it worked, and then I added a lot of code somewhere else, and suddenly it stopped working; the script is never called, a message I put there is not displayed.

So far I checked:
- button image: is there
- GUIs in front of the button: added none since then
- game paused: never happens in the game
- button.clickable

There is literally over a dozen other buttons in the same GUI that all call the same function, and they all don't work anymore. I can still call the function through the script and it works perfectly.
When I put text on the buttons, it doesn't "click-move" like it should.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Icey

button.Clickable = true;

I think this works.

Tamanegi

I think it doesn't (tried it nonetheless), especially since I didn't change the clickable attribute.

More suggestions?
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Icey

Is the gui itself clickable?

Tamanegi

Okay, the problem is solved and quite bizarre.

I set the button's NormalGraphic to 0 to make it invisible, then later animated the button with a view/loop. While the animation was playing, the button STILL had the size of graphic 0, which was the default 1x1 pixel clear sprite, so  the button was in fact 1x1 pixel large although it appeared larger through its animation.

I changed the sprite 0 to a button-sized clear sprite, and it works now.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

Khris

A better way is to set the button's .Visible to false. That way you won't have to change the size or image at all.

Tamanegi

Yes, but because I change the NormalGraphic of the button each time it is displayed, that saves me a command line each time I do it.

Or to be honest, at that time I didn't remember that I can make buttons invisible  :-[ ;) Changing the whole code is too much of a hassle now...
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

SMF spam blocked by CleanTalk