ID:1254298
 
Keywords: location, window
(See the best response by Jittai.)
Hello! I did a post about how to toggle on/off a interface's (it was a chat window) window, it ended pretty well, but now im facing this problem:
How can i control where this window will show up and how i lock the window in that locate?

Here is the windows code:
obj/chatbutton
name = "turnchat"
icon = 'base.dmi'
Click()
if(usr.toggle == 1)
usr.closechatproc()
else
usr.openchatproc()
mob/var/toggle=1
mob
proc
closechatproc()
set hidden=0
set category="Options"
winset(src,"chat","is-visible=false",)
src.toggle=0
mob
proc
openchatproc()
set hidden=0
set category="Options"
winset(src,"chat","is-visible=true;loc=1,1")
src.toggle=1
obj/chatbutton
name = "turnchat"
icon = 'base.dmi'
Click()
if(usr.toggle)//the ==1 is just a waste
usr.closechatproc()
else
usr.openchatproc()


Now back to the code. I am not really good with interface but I believe you have to place the Window (In the interface file) where it's supposed to be placed in.
In response to Haiji
If i do this, when i rezize the window, it mess up
Oh. Set the anchor to Auto Anchor for each Objects(Child,Label,etc.) in that window
If you want to lock it in place use a pane or strip the top bar from the window ie close buttons and title bar, this is only so a user can't move it, like so
http://i40.tinypic.com/35jf2p1.png
What i meant with lock the window there is that when i rezise the window, the chat move together, sry
In response to Haiji
Haiji wrote:
Oh. Set the anchor to Auto Anchor for each Objects(Child,Label,etc.) in that window

Remember, the chat is a window, not a control. Nezeha's asking for a way to get the chat window to be anchored to the main window.

As far as I know, there's no automatic way to do this. There are things you can do to attempt it, though, like making use of the Resize command or an infinite loop to constantly reposition the window.

What you'll need to do is use winget() to get the position of the main window (along with some text manipulation and text2num) and winset() to set the position of the chat window. The key parameter here (according to the Skin Reference) is "pos," not "loc."
In response to Haiji
But as says in the code, the chat is a separated window, is there a way that i can anchor a separated window in a label of another window?
I tried to put the output and the input with the map, but they goes UNDER the map and i cant see they, there is a way that i can change the output/input layer?
Something about "dominant control"?
In response to Nezeha
You're anchoring improperly.
Best response
If you want to modify the window's position you need to adjust the "pos" parameter. This parameter allows for "%" usage which iirc goes by the screen size. If not, you can always use java script to find the resolution.

Look into winset().

This is the JS I use:
client
Topic(t)
..()
var/nlist[] = params2list(t)
if(nlist["action"] && (nlist["action"] == "resol"))//If action exists & is set to assign resolution
src.scrwidth=text2num(nlist["width"])//assigns width to mob
src.scrheight=text2num(nlist["height"])//same here (with height)
client
New()
..()
src<<output({"<script language="Javascript">document.location.href = 'byond://?action=resol&width=' + screen.width+'&height='+screen.height;</script>"},"javascript")