I made a GUI that has a button to close it, but for some reason the button won't click. I haven't been able to figure out what's going on because I both have clickable set to true as the default and I also have the function for the onclick event set and without typos. As for the code itself I have
function GGOk_OnClick(GUIControl *control, MouseButton button)
{
GlobeGUI.Visible = false;
PortraitGUI.Visible = true;
}
With other buttons this has worked for me so I'm really at a loss rn
1. Is the OnClick function linked in the button's events table? You say typos but liking it via the ellipses button auto-generates the entire function signature...
2. Is another (transparent) GUI covering the button?
Quote from: Khris on Sun 09/10/2022 22:32:341. Is the OnClick function linked in the button's events table? You say typos but liking it via the ellipses button auto-generates the entire function signature...
2. Is another (transparent) GUI covering the button?
I used the ellipses to generate it, which is how I know there are no typos. As far as I'm aware there isn't another GUI blocking it, unless ones with their visibility set to false count
Ok, so try adding something like
Display("GGOk");
in the function to see if it runs or not.
If it doesn't show up, put a label (lblDebug) on a GUI and put something like this in repeatedly_execute_always:
int gui_id = -1;
GUI* g = GUI.GetAtScreenXY(mouse.x, mouse.y);
if (g != null) gui_id = g.ID;
int ctrl_id = -1;
GUIControl* gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (gc != null) ctrl_id = gc.ID;
lblDebug.Text = ("GUI: %d, Control: %d", gui_id, ctrl_id);
The GUI I'm struggling with or any other?
not sure if this is an important detail but I just noticed I can still interact with things behind the gui if I click in the right spot
fixed it. The GUI itself had clickable set to false