Suppose you want to implement a chat inside a picture windows, your chat area starts a X,Y = 50,50 and your width and height is W,H=300,300
You width is then 300 and you'd start displaying text at 50 + some margin: