Reputation: 2754
Why are my buttons not positioned at 0x0 within the box panels ?
main: layout [
size 680x400
origin 0x0
space 0x0
pad 0x0
at 0x0
across
Menu1: box brick 200x200
return
Menu2: box blue 200x300
]
Menu1-items: layout [
origin 0x0
space 0x0
at 0x0
button "1"
button "2"
button "Quit" [quit]
]
Menu2-items: layout [
origin 0x0
space 0x0
at 0x0
button "3"
button "4"
]
Menu1/pane: Menu1-items
Menu2/pane: Menu2-items
Show Menu1
Show Menu2
View Main
Upvotes: 0
Views: 165
Reputation:
Another similar solution is to use the /tight refinement of layout like this :
Menu1-items: layout/tight [
space 0x0
button "1"
button "2"
button "Quit" [quit]
]
Menu2-items: layout/tight [
space 0x0
button "3"
button "4"
]
Another approach would be to use PANEL element instead of BOX for having the sub-layouts inlined in one big block.
Upvotes: 1
Reputation:
The menu1-items layout itself has a default offset. Ditto for menu2-items.
There are two ways to address that. I've used one method for menu1-items, and the other for menu2-items. Pick the one you prefer:
main: layout [
size 680x400
origin 0x0
space 0x0
pad 0x0
at 0x0
across
Menu1: box brick 200x200
return
Menu2: box blue 200x300
]
Menu1-items: layout/offset [ ;; added /offset
origin 0x0
space 0x0
at 0x0
b1: button "1"
button "2"
button "Quit" [quit]
] 0x0 ;; added 0x0 for value of /offset refinement
Menu2-items: layout [
origin 0x0
space 0x0
at 0x0
button "3"
button "4"
]
menu2-items/offset: 0x0 ;; inserted setting of /offset variable
Menu1/pane: Menu1-items
Menu2/pane: Menu2-items
Show Menu1
Show Menu2
View Main
Upvotes: 1