ID:154993
 
How can I make a window in the Skin come otu in the center of my main Window?
Hmm, last time I checked, just move the window in the grid to where you want it to initially pop up...
In response to Speedro
I want a Window to pop up in in the main window. Not a control in to a window.
In response to Shadowkaroth
Use "pos=[X_pos],[Y_pos]" in winset.
In response to Megablaze
Megablaze wrote:
Use "pos=[X_pos],[Y_pos]" in winset.

The only problem with that is for people with different ressolutions.
In response to XxLucifersJesterxX
Uh, no, he can just use winget to find the pos of the main window, and center it based on that.
In response to Megablaze
Intresting thank you. I could pull each ressolution and just round out the center from it. Correct?
In response to Shadowkaroth
No, ignore the resolution thing Lucifer said. Using winget you'll get a text variable of the position, using both findtext() and copytext() you can pull the Xpos and the Ypos in seperate variables. Then you convert it into a number using text2num(). You add a number to the Xpos and Ypos, you can find out the exact center with math, or just guess till it's around the spot you want. Then use winset to set your new window pos the way i wrote it before. I'm not going to write out the code for it, you can figure it out yourself, or if someone wants to write it out for you they can do so.
In response to Megablaze
I appreciate the help. Many times no one helps people on the forums. Or only posts once. So I very much appreciate your multiable responses.
In response to Megablaze
Wouldn't a JavaScript return be more efficient? I'm actually not sure, I'm just wondering.
In response to A. Ness
Thanks, A. Ness! This will svae me some time and trouble. Would have been to try and make it on my own but this will svae me some time for sure. I appreciate it.

If there is a more effecient way using Javascript I can;t imagine a way to do it.
In response to Shadowkaroth
Shadowkaroth wrote:
Thanks, A. Ness! This will svae me some time and trouble. Would have been to try and make it on my own but this will svae me some time for sure. I appreciate it.

If there is a more effecient way using Javascript I can;t imagine a way to do it.

Well, here's what I use:

var {

screen_grab = {"
<script type="text/javascript">
document.location.href = 'byond://?action=screengrab&screen_x='+screen.width+'&screen_y='+screen.height;
</script>
"}

}

client {
New() {

. = ..()

winset(src,"input_window","title=[src]")
src << output(null,"JS_BROWSER")
src << output(screen_grab,"JS_BROWSER")

}

Topic(href) {

var/actionlist[] = params2list(href)
if(actionlist["action"] && (actionlist["action"] == "screengrab")) {

screen_x = text2num(actionlist["screen_x"])
screen_y = text2num(actionlist["screen_y"])

winset(src,"default","pos=[(screen_x/2)-208],[(screen_y/2)-94]")

}

}

}
In response to CauTi0N
Not sure if it's more efficient, but there was issues with delays/ignoring javascript before, so I didn't suggest it.
In response to Megablaze
Megablaze wrote:
Uh, no, he can just use winget to find the pos of the main window, and center it based on that.

Then say that, not just use positions. Hes most likely new to anything along the terms of positioning if hes asking for help. You need to learn to be a bit more specific when explaining something.
In response to D-Cire
Well I can't seem to figure out how to pull the size properly when the main window is maxed?