View Single Post
01/22/19, 11:19 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
Hey,

This is something I did in the Set Crafter, if you want another code example. One trick I did was, in the OnResizeStart handler add (essentially) EVENT_MANAGER:RegisterForUpdate("WindowResize",10, SetCrafterWindow.dynamicResize)


And then in the dynamcResize function, you can do stuff to resize other stuff as needed.


That said, in your case, I don't think you'll need that. Playing around with the anchors should do the trick for you. It might not be quite enough to just set the anchors for the containing control - you'll probably also need to set two anchors to parts of the row controls themselves. Also, note that text (i.e. a label) will *not* be resized by changing the anchor or dimensions. You'll probably need to change the size of the text itself.


Another option is changing the scale. Changing the scale is likely the easiest method, since it cascades through children but it does look a little wonky if the resizing goes too far. And make sure you're not changing the scale of the TopLevelControl that you're resizing; that will make it jittery, and prone to 'blowing up' to a huge size. So just make sure the minX and minY isn't too small.


Other things to note, SetScale doesn't change the anchor distances, so that can make stuff look wonky too. You can use spacer controls for that.


note: Been a while since I did the resizing. I *think* most of that stuff is right but... it's been a while.
  Reply With Quote