Last active
August 19, 2017 15:13
-
-
Save greggirwin/8d0b1c02ccdbd5520d9c77d49ea91ada to your computer and use it in GitHub Desktop.
VID version of Nenad's Native Red PicoSheet
This file contains 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
Red [ | |
Title: "Tiny VID Spreadsheet" | |
Author: ["Gregg Irwin" "based on Nenad's Native PicoSheet"] | |
Needs: View | |
] | |
sheet-size: 8x8 | |
cell-size: 100x24 | |
L: charset "ABCDEFGHIabcdefghi" | |
N: charset "123456789" | |
D: union N charset "0" | |
_on-create: _on-unfocus: function [f e][ | |
f/color: none | |
if rel: f/extra/old [react/unlink rel 'all] | |
text: copy f/text | |
f/extra/formula: copy text | |
if #"=" = f/extra/formula/1 [ | |
if rel: f/extra/old [react/unlink rel 'all] | |
parse remove text [ | |
any [ | |
p: L N not ["/" skip not N] insert p " " insert "/data " | |
| L skip | |
| p: some D opt [dot some D] insert p " " insert " " | |
| skip | |
] | |
] | |
f/text: rejoin [f/extra/name "/data: any [math/safe [" text {] "#UND"]}] | |
if f/data [any [react f/extra/old: f/data do probe f/data]] | |
] | |
] | |
_on-focus: func [f e][ | |
f/text: any [f/extra/formula f/text] | |
f/color: yello | |
] | |
;------------------------------------------------------------------------------- | |
sheet: [ | |
style col-hdr: text cell-size center | |
style row-hdr: col-hdr 32x24 | |
style cell: field cell-size right | |
on-create :_on-create | |
on-unfocus :_on-unfocus | |
on-focus :_on-focus | |
space 0x0 | |
across | |
] | |
append sheet [row-hdr] | |
col: #"A" | |
loop sheet-size/x [ | |
repend sheet ['col-hdr form col] | |
col: col + 1 | |
] | |
append sheet 'return | |
repeat y sheet-size/y [ | |
repend sheet ['row-hdr form y] | |
col: #"A" | |
repeat x sheet-size/x [ | |
ref: to word! append form col y | |
append sheet compose/deep [ | |
(to set-word! form ref) cell (copy "") extra ( | |
object [name: form ref formula: old: none] | |
) | |
] | |
col: col + 1 | |
] | |
append sheet 'return | |
] | |
view sheet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved actors to cell style