Home   Archive   Permalink



wanna place a screen independent button with at m1 x m2 button 'hi' []

Hi ,
is it possible to use variables instead of
integer value for at command ?
Project : REAL screen independent GUI
    
    
R E B O L [title 'screenindependent']
    
x: system/view/screen-face/size/1    ;; Width in a variable
    
y: system/view/screen-face/size/2 ;; Height in a variable
    
x1: x / 100    ;; 100 percentage steps
    
y1: y / 100
    
    
    
x2: x1 / 2     ;; half screen size is now 100%
    
y2: y1 / 2
    
    
print x        ;; screen full size
print y
    
print x1     ;; 1 % of it
print y1
    
print x2     ;; if you use a half screen then half is now 100% size and x2 is 1% of it
print y2
    
    
m1: x2 * 75    ;; try to set a variable m1 that contains 75% of the window Width
m2: y2 * 10
    
    
view center-face layout [ size system/view/screen-face/size / 2     ;; window IS 50% of machine screen size
    
at m1 x m2 button 'i am screen independent' []             ;; want to place a button on 75% width of the main window
    
    
]

posted by:   Mennohexo       26-Jun-2017/7:32:50-7:00



I'd suggest using a function to do the translations for you. In this case I've wrapped the function in it's own context with the base unit sizes (I tend to do this to isolate words that aren't used anywhere else).
    
https://gist.github.com/rgchris/2fc9af8ee841514cb1f06b9cd00d8fef

posted by:   Chris       27-Jun-2017/16:04:58-7:00



Hey Chris ,
    
that code you made is really clever.
    
I will try it.

posted by:   Mennohexo       27-Jun-2017/17:37:15-7:00



Name:


Message:


Type the reverse of this captcha text: "t x e n - o g"



Home