HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Dock GUI control with margin?  (Read 1133 times)

Legacy

  • General Accounts
  • *
  • Posts: 117
    • View Profile
[Resolved] Dock GUI control with margin?
« on: May 03, 12, 01:00:26 PM »

Hello I have a GUI related question this time:

Is it possible, when you specify Dock mode for your control to have a margin from screen edge? I know I can make it a child of a transparent panel that would work I am just looking for some more elegant solution :)

Thanks

EDIT: also, how would one dock item to center of the screen/edge?
« Last Edit: Nov 01, 12, 11:34:50 AM by HE-Cooper »
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Dock GUI control with margin?
« Reply #1 on: May 03, 12, 01:25:21 PM »

We use spacer panels to do the docking with margin. Truthfully, it's all a little over complicated for much of the default usage, but as with all things in the engine, it pays off when you are trying to do complicated things.

I would check out FPS Ref's UI as it pretty much has an example of every easy default docking and placement of UI elements. Between the system menus, and the game UI.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Dock GUI control with margin?
« Reply #2 on: May 03, 12, 06:42:53 PM »

You could also use a 9-slice as the parent where the 8 outer sections can serve as a margin.

EDIT: A note about this technique which I discovered recently when doing this.  After setting the margin and then setting a child to dock FILL, it seemed to fill everything and not respect the margin. But it simply was not updating the display properly; saving, closing, and re-opening showed that the margin did properly rein in the fill control.
« Last Edit: May 07, 12, 05:04:26 PM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.