Created
June 26, 2017 14:40
-
-
Save rgchris/2fc9af8ee841514cb1f06b9cd00d8fef to your computer and use it in GitHub Desktop.
Screen independent sizing in Rebol/View 2.7.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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