I'm trying to replace all my Displayed text by a custom message window GUI.
In order to get the window to close again, I thought of the following:
- Make an invisible button as large as the new message window.
- When the GUI opens, set mouse cursor to 6 (the pointer).
- When the user clicks on the huge button, close the window with GuiOff.
- Reset the cursor.
My problem now is that in order to display text on the window, I need a label, and apparently the label overrides the button, i.e. when I click on the window anywhere outside the text label, it closes, but when I click on the text, it doesn't recognize this as a click on the button.
This is what it looks like so far... the edges for the button are a bit hard to see because they're bright pink on a slightly darker pink, but the button basically spans the whole image, while the label text will go where the green letters say "1,2,3,etc" at the moment:

Is there a way to
a) either change some sort of z-order to put the label behind the button
or
b) another clever way of closing the window with a single mouse click?
EDIT:
As an alternative, I thought I might dispense with the button and just check on every mouse click if the GUI was open and if so, close it. So I added the line
{if (IsGUIOn(3)==1) GUIOff(3);}
to the function on_mouse_click for the left button. Nothing happened. Any idea why? I've tried it with both a clickable and a non-clickable GUI.
EDIT #2: The above works, but only if I put it right on top of the on_mouse_click function, even before the check for IsGamePaused. Now it reacts to left and right-clicks, which is not what I want.
Why can't I use
else if ((button==LEFT) && (IsGUIOn(3)))
{
GuiOff(3);
}
?