Home   Archive   Permalink



how to change the space when the screen size is changing ?

Hi ,
we spoke about the screensize variable and how to
get it in Rebol. It works.
    
Here is a simple code example from the REBOL/View
Tutorial that describes the space command.
    
Let us assume the user is starting the application
on a computer with greater screen.
    
Now it is better to take a greater space between
the widgets , but how to make the
space command to get a variable value ?
    
Example : not space 20x16
    
             but such like space AxB
    
And A contains the value 40
     B contains the value 32
    
    
i assume there is a syntax error.
    
How to make that anyhow ?
    
    
    
space 20x16
button 'Button 1'
button 'Button 2'
return
button 'Button 3'
button 'Button 4'

posted by:   Mennohexo     26-Jun-2017/9:12:12-7:00



COMPOSE works well for this sort of thing:
    
A: 40
B: 32
    
view layout compose [
     space (to-pair reduce [A B])
     button 'Button 1'
     button 'Button 2'
     return
     button 'Button 3'
     button 'Button 4'
    ]
    

posted by:   Sunanda     26-Jun-2017/15:32:35-7:00



In this case, parentheses are evaluated in the layout block (without 'compose), and 'as-pair is a few characters simpler:
    
A: 40
B: 32
        
view layout [
     space (as-pair A B)
     button 'Button 1'
     button 'Button 2'
     return
     button 'Button 3'
     button 'Button 4'
]

posted by:   Nick     26-Jun-2017/23:05:38-7:00



Thanks Nick.
It works well.

posted by:   Mennohexo     27-Jun-2017/17:42:11-7:00