• Trouble understanding Panel:Dock()
    9 replies, posted
Hi FacePunchers ! I don't really understand how Panel:Dock() works, i'm trying to position 3 DPanel inside a DFrame using Dock( LEFT ) & Dock( RIGHT ) & for the third one, i don't really know, maybe with a SetPosition(), but when i use Dock( LEFT ) & Dock( RIGHT ) the panel is ignoring the height i gave him, instead it fills all on the height of the DFrame, but the panel is not ignoring the width... I don't understand ! If someone can explain it to me it would be great Thanks in advance, sorry for my horrible english tho. :/
Docking to the left or right ignores the height and docking to the top or bottom ignores the width. Set the width before docking it and then set the height after docking it. As for the bar you can make your own panel you can use PANEL
I didn't understand the part about PANEL:Paint(), i'm using a DFrame what should i do to remove the topbar ?
As someone who's still learning good UI design, I reeeeaaaallly don't like Dock. I'll use it here and there for really simple things (throwing panels into a panel list, for example), but I just don't like using it for anything else. I'd much rather figure out the placement in my head or using formula, especially considering "Dock" is only available in GLua, and not in any other language.
I completely disagree. I love Dock. It's at least 1000 times better than using math because the equations always end up with tons of decimal places and it looks like a horrible mess because it is. Dock was made specifically to avoid this sort of thing, and ever since I started using it, it's been absolutely fantastic and far less stupid and useless than the inaccurate math that other languages offer. It even has methods such as DockMargin and DockPadding which make it way easier and avoid complicated maths to do simple margins.
  self:StretchToParent(0, SCREEN_HEIGHT * 1/6, SCREEN_WIDTH * 5/6, SCREEN_HEIGHT * 1/6) I used this, at it's like margin, it's responsive and same on each resolution
I think dock would be at least a million times better if you could get the size of a docked element. As it stands, pnl:GetSize() is wrong for docked panels unless it's used during PANEL:PerformLayout. And I know about the alleged fix of pnl:InvalidateLayout(true) before pnl:GetSize() but I've never once observed that as working.
yeah, that is a bit annoying. Try invalidating in a 0 second timer and it might work
Joke on you i used DockMargin() finally and even with it it's fcked up
Sorry, you need to Log In to post a reply to this thread.