ID:161734
 
When a player closes a window by clicking the x at the top right corner, is there a way to capture that event, so the game would know "Player1 has closed this window".

Or would we have to continuously ping the player to see if they have that window open in their interface? When a window gets closed does it get deleted or is it still there waiting to be opened again? What about in the case of cloned windows? Could this be a problem if a player makes hundreds of cloned windows?
No one?

This is very important
What exactly do you mean? Like, if they close Dream Seeker or if they close a browse window caused by the browse proc?
Obs wrote:
When a player closes a window by clicking the x at the top right corner, is there a way to capture that event, so the game would know "Player1 has closed this window".

Only by occasionally pining the player to check if the window is-visible or not.


When a window gets closed does it get deleted or is it still there waiting to be opened again?

As far as I know, no windows ever get deleted. There is no way to remove wincloned windows, either.

Could this be a problem if a player makes hundreds of cloned windows?

It could be, just don't let them do that. You may not be able to control windows closing, but you can control which new ones are opened.
In response to Xooxer
Could this be a problem if a player makes hundreds of cloned windows?

It could be, just don't let them do that. You may not be able to control windows closing, but you can control which new ones are opened.


That's not really desirable.

For instance, if a player examines an item and you want to open up a new window to show a nice examine window with some of that items stats, it should be a new window. If you can't ever really delete cloned windows, then thats going to be a problem when the player has examined thousands of items in the game.

It just sounds like this is going to be a pain in the ass to get right and it makes me think GUI interfaces weren't meant to be used this way.
In response to Obs
Just use the same window. When they examine each item, replace the info on whatever "examine it" window and set is-visible. Or do you want them to have multiple "examine it" windows?
In response to Obs
You can use a single window for all your window needs, or a single window type for more specific needs, which would be shared by everyone.

All you need to do is show the info to the player through the window instance they see. Other players can see different info in the instance of that window they are shown.

The only time you'd need cloned windows, is if you want to allow multiple windows of the same type to be opened for a single user.

I clone IM windows, since I want players to be able to have multiples IMs going on at once. My settings windows, help window, map and others are shared by everyone, and I only show them what they need to see.

There's no reason a player should be able to open unlimited windows, anyways. Even with wincloning, you can re-use old clones if they are no longer in use. You don't always need to make a new clone.

[edit]

Also, when cloning windows for players, you should have a maximum limit on the number they can open at once. 5 should be plenty for anyone. Each clone can serve all the players in the world at once, like a normal compiled-in window can be shared. You only need one clone for the maximum number you wish a user to see, and everyone can share those clones giving you, essentially, 5 clones for each player, using only 5 clones of a compiled-in window.

You really only need to worry about how many windows are in your project altogether. As long as you practice good window management, you shouldn't have any worries about user cloned windows crashing your game. It's like protecting your chat from spam, or not using a ton of lists or objects that might crash your game. You just have to pay attention to what the program is using, and make sure you reuse or remove resources as needed.

~X
In response to Xooxer
I have no choice but to use one window now, but it would have been nice if they could have opened multiple windows, because now they are limited to examining only one thing at a time. Or I could have let them have a limit on the number of examine windows, but I am content with what I've implemented now.

I know very well that the same window for different players will show different things, it's a feature I've worked hard to eliminate for some cases.

BYOND's GUI system still has a long way to go.