HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: 2 gui windows on the same layer  (Read 2128 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
2 gui windows on the same layer
« on: Apr 24, 14, 03:47:04 PM »

If i have 2 gui windows on the same layer, and i want to bring one of them in front of the other programmatically... how do i do that?
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: 2 gui windows on the same layer
« Reply #1 on: Apr 24, 14, 04:00:24 PM »

just to clarify, i would like to avoid recreating it or changing layers if it is possible

the scenario is like this:
- the window is hidden on a default layer (visible=false)
- the window gets unhidden (visible=true) and pops out behind other windows on a default layer <--- this is the problem

I would like it to pop up in front of other windows
« Last Edit: Apr 24, 14, 04:05:12 PM by AWW_boss »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: 2 gui windows on the same layer
« Reply #2 on: Apr 24, 14, 05:35:26 PM »

When you look at the hierarchy of controls in the tree view of the GUI editor, controls which are farther down in the list appear on top of those higher up.  Which is to say that the children of a given control are rendered in order so that the last one is rendered last and thus on top of the siblings.   Thus, what you need to do is to make sure the newly shown window is rendered in a later order than the one that was blocking it.  If the blocked window and that which blocks it are together in a gui control, you can manipulate their order in the hierarchy using the buttons at the top of the gui control view.

Otherwise, for changing render order at runtime: if they are siblings, it is simply a matter of re-adding the blocked window to its parent using add back.  I'm pretty sure you don't even need to remove it first, as add back will take care of moving it to the back.  If they are not immediate siblings, you need to be sure that the chain of controls leading to the blocked control goes after the chain of controls blocking it.

Another option is that controls have a boolean field that when set will cause the control to be brought to the front when clicked.  I have not actually tried that one out, so for all I know it might only work relative to the control's siblings.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: 2 gui windows on the same layer
« Reply #3 on: Apr 25, 14, 01:54:43 PM »

Hi! Thanks i will try that.

But also, although i wrote that i would like to avoid changing layers i found out that this worked for me(as suggested by Thazager):

        inventoryWindow.layer = "alert"
        inventoryWindow.layer = ""
        inventoryWindow.visible = true

I am placing the window in another layer and then immediately returning it to the default layer, which makes it pop in front. I believe that is more or less the same thing as you suggested, i.e. moving it to the back of the GUIMasterLayer children list.
Logged