(SOLVED) GUIs Overlapping Causing Issues (Z-Order)

Started by Vault15, Wed 31/10/2012 20:43:04

Previous topic - Next topic

Vault15

Imagine a character creation gui separated into 2 parts (AGS only allows a certain number of buttons per Gui). The top Gui (1024x768) has a background and buttons/input boxes. The bottom Gui (1024x768) has more buttons, a description box and a transparent background/border.

I have the top and bottom Guis both set to ZOrder 0. The bottom gui has a transparent background (I was simply trying to overlap the top layer) so when they are both displayed at once (1024x768 dimensions each) I can see everything BUT I can't click the top Gui buttons at all. It's just displayed as if the top Gui is a solid static picture while the bottom is active.

Is there a way to make the top and bottom guis active depending on which half of the screen that the mouse is in? The annoying solution I already realize is to separate the background into two sections and map one to only display at the top (0,0) - (1024,384) (as if drawing a box), while the other would be (0,384) - (1024,768).

Khris

A GUI needs to be clickable if it has buttons and stuff on it (as opposed to being used just for graphic effects).
Thus, regardless of the background, only one GUI will work if you put them on top of each other.
Giving them the same zOrder won't magically make them merge or something, it'll just make the order depend on arbitrary things like the order in the editor.

You can of course turn them clickable and not clickable in repeatedly_execute:
Code: ags
  gGUI1.Clickable = (mouse.y < 384);
  gGUI2.Clickable = !gGUI1.Clickable;


What I would do though is put the background on the bottom GUI, then put the other GUI on top but make it only half as wide/tall so it doesn't cover the controls of the bottom one. Problem solved, and without annoyances.

Vault15

Quote from: Khris on Wed 31/10/2012 21:13:12
A GUI needs to be clickable if it has buttons and stuff on it (as opposed to being used just for graphic effects).
Thus, regardless of the background, only one GUI will work if you put them on top of each other.
Giving them the same zOrder won't magically make them merge or something, it'll just make the order depend on arbitrary things like the order in the editor.

You can of course turn them clickable and not clickable in repeatedly_execute:
Code: ags
  gGUI1.Clickable = (mouse.y < 384);
  gGUI2.Clickable = !gGUI1.Clickable;


What I would do though is put the background on the bottom GUI, then put the other GUI on top but make it only half as wide/tall so it doesn't cover the controls of the bottom one. Problem solved, and without annoyances.

That was incredibly helpful, thank you! That completely solved it. I knew there was a simple shortcut out there  :)

SMF spam blocked by CleanTalk