ID:161975
 
If I make clones of windows how would I be able to detect the current window a certain GUI element of that window is in?
Hm, this is a very interesting sentence I obtained via the skin reference:

Special winget() calls

Calling the winget() proc with a blank or null control ID can return some values that belong to the whole program.

winget(player, null, "focus") will return the ID of the control, if any, that currently has keyboard focus.

winget(player, null, "windows") will return the IDs of the windows available in the program, separated by semicolons.
In response to GhostAnime
GhostAnime wrote:
Hm, this is a very interesting sentence I obtained via the skin reference:

Special winget() calls

Calling the winget() proc with a blank or null control ID can return some values that belong to the whole program.

winget(player, null, "focus") will return the ID of the control, if any, that currently has keyboard focus.

winget(player, null, "windows") will return the IDs of the windows available in the program, separated by semicolons.


Good stuff. Pretty hidden feature though.

In response to Obs
Yeah, I never knew about that until I was looking for your answer through the skin reference. I should read other special features about the skins... hm.
In response to GhostAnime
But it still doesn't solve my problem. I have a button that when pressed must trigger a command that must know the name of the window that button was in. Using "focus" only gets rid of the button itself.
In response to Obs
Give the button a different verb to trigger.
In response to Traztx
Traztx wrote:
Give the button a different verb to trigger.

What I've tried is setting up the verb for the button to be a command that takes in a text string, which is the name of the window. The idea is that when the clone is created I could somehow change that text string to the name of the window and thus the correct window will be referenced. But I can't seem to get the syntax working.


I cannot just set a different verb because a player could easily open up dozens of copies of the same window, and that would quickly get out of hand. This must be automated.
In response to Obs
So when the window is cloned, you have code that gives it a unique id, right? Could that code also winset the command parameter of the button on that new window to hard-code it to provide that same id for whatever verb it is calling?

I don't know what exactly you are doing to clone the window, but it's worth considering.
In response to Traztx
Traztx wrote:
So when the window is cloned, you have code that gives it a unique id, right? Could that code also winset the command parameter of the button on that new window to hard-code it to provide that same id for whatever verb it is calling?

I don't know what exactly you are doing to clone the window, but it's worth considering.


Yes, I tried that, I'm saying it didn't work, or the syntax was messed up. The skin reference isn't too clear on this.
In response to Obs
Yeah, the only example in the skin ref is when creating or deleting controls at runtime it has this:
params["command"] = "say \"This is a new button.\""


So I would expect replacing with something like this to work:
params["command"] = "mybuttonverb \"[cloneid]\""


And the verb to be like this:
mybuttonverb(cloneid as text)


But I haven't done anything this sophisticated.