ID:2147190
 
Is it possible to anchor a window within a window.

I'm doing some work for friend and he is requesting a transparent chat which is doable, now I'm wanting to anchor the window on the bottom left corner, so when a player resizes or adjust the window the chat adjustes aswell. Is this possible?
Okay, I created a code to reposition the chat.
    proc
AnchorChat()

var/scrnpos=winget(src,"default","pos")
var/scrnpos1=text2num(copytext(scrnpos,1,findtext(scrnpos,",")))
var/scrnpos2=text2num(copytext(scrnpos,findtext(scrnpos,",")+1,0))
var/mapsize=winget(src,"default.map1","size")
var/viewy=text2num(copytext(mapsize,findtext(mapsize,"x")+1,0))
var/sy=viewy+scrnpos2
var/paddingx=10
var/paddingy=-80
winset(src,"chat","pos=[scrnpos1+paddingx],[sy+paddingy]")

The only problem is I only know how to call this function when its resize. Do you know how I can call it when a window is moved?


Notice how the chat window repositions on Resizing but not when moving the window.
You can use child controls to display windows within windows with anchoring and all.

Keep in mind though, putting interface elements, especially transparent ones, over your map, is going to dramatically harm the performance of your game. (transparent windows force it into software rendering mode, and putting elements over the map causes client slowdowns)
This is my first time using a child, its taken over the interface, meaning I can't focus the map. Macros aren't working for movement or anything.
You can try setting the macro set of the window contained within the child to the macro set used for movement and the sort. Shouldn't make a difference unless the child contains something that's taking focus though.
That worked thx again.