Docking

Wednesday, August 24, 2011

I added Docking to GMod a while ago. GWEN uses it too. I don't think many people designing GUI layouts in GMod know about it (probably because I only added it in the last 6 months and they're learning from older code).

I always feel like I learn better by looking at images rather than text. So here goes (this is in GWEN but it's the same principle in GMod)

New Window

New ButtonĀ called Bart

Dock Bart 'Left'

New Button Homer - Dock 'Fill'

Dock Bart 'Bottom'

Dock Homer 'Left'

Send Homer To The Back

Reduce Homer's Width

Add Marge - Dock 'Fill'

Change Homer's Margin (0,0,4,0) (l,u,r,d)

Create Button ':D' on Homer, Dock 'Bottom'

Change :D margin to (4,4,4,4)

As you can see it makes laying out your controls set and forget. Previously you'd be setting the layout in something like PerformLayout - manually working out pixels, subtracting from the width of the parent. It gets messy.

Docking isn't appropriate for everything but it works for a lot of stuff. It also has the advantage that it automatically scales when stuff gets resized.

More Rubbish

Your Portfolio Gave Me Diarrhea

Friday, October 1, 2021

Motivation

Friday, September 24, 2021

We got married

Thursday, September 16, 2021

Unity Quiz

Sunday, September 6, 2020

Everything We Watched In Lockdown

Thursday, September 3, 2020

Steam Chat

Tuesday, August 23, 2011

Selling a Car Online

Monday, August 22, 2011

My First PC Games

Sunday, August 21, 2011

WIT: From Dust

Friday, August 19, 2011

That GMod Update

Thursday, August 18, 2011