Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Window's Order  (Read 3645 times)

0 Members and 1 Guest are viewing this topic.

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Window's Order
« on: August 16, 2007, 12:00:36 PM »

Hi. I have several windows that overlay on my screen to create the game interface. Mostly this works fine, however, at Random times the order of those windows changes during a Game.ChangeScene. This leaves the interface and game unusable. How can I specify the order the windows should stay in?

Thanks  :)
Logged

CMK2901

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 35
  • Zoidberg is afoot!
    • View Profile
    • CMK Studios
Re: Window's Order
« Reply #1 on: August 17, 2007, 05:47:14 AM »

Well, what I'd expect is happening, if this only happens when you call a SceneChange, there is something which is causing your windows to either be loaded in the wrong order, or is simply messing up the z-indexes of the windows.

From my rather limited experience with these things, I would suggest the following, none of which I am sure will work.  ;D

1) The window object has several methods for setting the z-index of a window (MoveAfter, MoveBefore, MoveToTop, MoveToBottom).  If you aren't familiar with z-index, the easiest way to imagine it is papers on a desk. 

If there were a stack of papers on a desk, the one at the bottom would have a z-index of 0, and anything above it would have increasing numbers.  Lower numbers are under the object, and larger numbers are above the object.  So, an object with z-index of 5, for example, would display over anything with a z-index less than 5, but under anything with a z-index greater than 5.

So, you could devise a function/method that checks the NextSibling and PrevSibling properties of a window, and moves them with MoveAfter or MoveBefore to the right spots.  Unfortunately, I can't find a function or property that allows you to simply say "Window.z = 4;" for example.

2) If that doesn't sound too great, I'd ask you: are you loading the windows into new variables every time you change a scene?  If so, that may be causing the z-indexes to screw up with a scene change (though I'm very unsure about that) because of reinstantiated data.  Personally, I keep global variables for the more vital parts of my interface, so that I only have one instance of them floating around...it makes it much easier to maintain the object's properties, such as z-index, I'd imagine.

Though I have no experience with WM's window order, and this is all speculation, I hope you'll find it helpful.
Logged
CMK Studios
I don't think we're hearing the same voices.

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Window's Order
« Reply #2 on: August 19, 2007, 12:04:24 PM »

window.Focus() will bring the window to foreground.


2) If that doesn't sound too great, I'd ask you: are you loading the windows into new variables every time you change a scene?

I'd ask that too, because normally scene change shouldn't affect the z-order at all.
Also, it it necessary to use multiple windows for the GUI? Consider using nested windows (you know, one window can work as a container for other windows in WME).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Re: Window's Order
« Reply #3 on: August 21, 2007, 12:31:36 PM »

Thank you for your suggestions, I shall try and use both ideas ( window.Focus() MoveAfter, MoveBefore, MoveToTop, MoveToBottom ) which should stop it happening.

The curious thing is that the windows loading code is only called once per game, (as far as I can tell) which was why I became a little confused as to their order changing.

 :)
Logged
 

Page created in 0.027 seconds with 19 queries.