AntumDeluge Cheater
Reputation: 0
Joined: 20 Dec 2018 Posts: 48
|
Posted: Thu Feb 21, 2019 5:09 pm Post subject: [Solved] Can't Get Child to Expand with Parent |
|
|
I've created a Form with two children: A Label & a Panel. In the Form Designer I can set the anchors & get the panel to fill the space of the Parent Form & resize with it. However, I can't seem to figure out how to do it in Lua scripting.
Example code:
Code: | local form = createForm(false)
form.BorderStyle = bsSizeable
local label = createLabel(form)
label.setCaption('Label 1')
label.AnchorSideTop.Control = form
label.AnchorSideTop.side = asrTop
label.AnchorSideLeft.Control = form
label.AnchorSideLeft.Side = asrCenter
local panel = createPanel(form)
panel.setColor(255)
-- anchor the top of the panel to the bottom of the label
panel.AnchorSideTop.Control = label
panel.AnchorSideTop.Side = asrBottom
-- anchor other sides of panel to main form
panel.AnchorSideLeft.Control = form
panel.AnchorSideLeft.Side = asrLeft
panel.AnchorSideRight.Control = form
panel.AnchorSideRight.Side = asrRight
panel.AnchorSideBottom.Control = form
panel.AnchorSideBottom.Side = asrBottom |
I have attached an example image of what I want it to do.
Edit: D'oh! I just figured it out. I have to set the Anchors property string value:
Code: | panel.Anchors = '[akTop,akBottom,akLeft,akRight]' |
I thought the Anchors property was a table.
Description: |
|
Filesize: |
4.68 KB |
Viewed: |
1301 Time(s) |

|
|
|