Home   Archive   Permalink



add padding to button

I have a series of buttons, top to bottom. I want to put a little more space between a few of those. Like...
    
btn001
btn002
    
btn003
btn004
btn005
    
btn006
btnNNN
    
What do I use for padding? I was thinking an invisible button, but that's an ugly cludge.


posted by:   c.k.lester       20-Aug-2015/16:19:19-7:00



R E B O L []
do %r3-gui.r3
;1st example
view [
    vpanel [
        btn001: button "btn001"
        btn002: button "btn002"
        btn003: button "btn003"
        btn004: button "btn004"
        btn005: button "btn005"
        btn006: button "btn006"
        btnNNN: button "btnNNN"
    ] 320x240 options [row-min: [20 40 20 20 40 20]]
]
;2st example
view [
    vgroup [
        vgroup [
            btn001: button "btn001"
            btn002: button "btn002"
        ]
        vgroup [
            btn003: button "btn003"
            btn004: button "btn004"
            btn005: button "btn005"
        ]
        vgroup [
            btn006: button "btn006"
            btnNNN: button "btnNNN"
        ]
    ] options [spacing: 12x20]
]

posted by:   Linh       20-Aug-2015/23:27:27-7:00



I would prefer non-static sizing/positioning. Maybe just an empty label! I'm at home about to go to bed. I'll try your method in the morning.
    
Thank you for the help!


posted by:   c.k.lester       21-Aug-2015/1:09:48-7:00



Is this REBOL 2, or do we assume that most of the experimenting with REBOL has moved on to R3?    
    
If REBOL 2, are you aware of the "space" and "pad" options?    
    
Default spacing:
    
R E B O L [ ]
view layout [
     across
     button "button 1"
     button "button 2"
     return
     button "button 3"
     button "button 4"
]
    
The "space" keyword for setting the spacing of all window styles:
    
R E B O L [ ]
view layout [
     space 50x50
     across
     button "button 1"
     button "button 2"
     return
     button "button 3"
     button "button 4"
]    
    
The "pad" keyword for adding space piece-by-piece as it were:
    
R E B O L [ ]
view layout [
     across
     button "button 1"
     pad 50x0
     button "button 2"
     return
     pad 0x50
     button "button 3"
     pad 50x0
     button "button 4"
]    
    
    
    
    


posted by:   Steven White       21-Aug-2015/11:30:23-7:00



Thanks, Steven! I tried pad and it worked fine. But I threw in some blank labels to get the look I want, without having to specify point dimensions. If I change the interface, I don't want to have to change all my static spacing/padding. It's nice to just shuffle the interface (if I ever have to) without worrying about pixel-based sizing and positioning.
    
It's ugly, though. Here's what I've got:
    
view center-face layout [
    across
    btn "Send iNet Email"
    return
    label ""
    return
    btn "Zip Authorizer"
    btn "Add Inventory"
    return
    below
    label ""
    btn "Template Authorizer"
    btn "View iNet History"
    btn "View Log File"
    btn "Exit" [quit]
]
    
I'm going to look into centering the buttons on the window and getting them to expand horizontally to fill the space.


posted by:   c.k.lester       21-Aug-2015/15:43:38-7:00