Skip to content

Instantly share code, notes, and snippets.

@rgchris
Created June 26, 2017 14:40
Show Gist options
  • Select an option

  • Save rgchris/2fc9af8ee841514cb1f06b9cd00d8fef to your computer and use it in GitHub Desktop.

Select an option

Save rgchris/2fc9af8ee841514cb1f06b9cd00d8fef to your computer and use it in GitHub Desktop.
Screen independent sizing in Rebol/View 2.7.8
Rebol [
Title: "Screen Independent"
Date: 26-Jun-2017
Author: "Mennohexo"
]
probe base-size: system/view/screen-face/size / 2
vs: use [base][ ; VS named after VW/VH CSS convention
probe base: reduce [base-size/x / 100 base-size/y / 100]
func [size [pair! integer!]][
switch type?/word size [ ; type?/word needed for SWITCH
pair! [as-pair size/x * base/1 size/y * base/2]
integer! [round size * base/1]
]
]
]
view center-face layout [
size vs 100x100
at vs 75x10 button vs 20 "I am screen independent" [] ;; want to place a button on 75% width of the main window
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment