Skip to content

Instantly share code, notes, and snippets.

@dockimbel
Last active October 14, 2017 05:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dockimbel/b0a413342dc39568696207412a2ef5e7 to your computer and use it in GitHub Desktop.
Save dockimbel/b0a413342dc39568696207412a2ef5e7 to your computer and use it in GitHub Desktop.
Red [Needs: View]
L: charset "ABCDEFGHI"
N: charset "123456789"
D: union N charset "0"
p: []
repeat y 9 [
repeat x 9 [
col: either x = 1 [#"^(2028)"][#"A" + (x - 2)]
ref: to word! append form col y - 1
header?: (y = 1) or (x = 1)
append p set ref make face! [
size: 90x24
type: pick [text field] header?
offset: -20x10 + as-pair
((x - 1) * size/x + 2)
((y - 1) * size/y + 1)
text: form case [
y = 1 [col]
x = 1 [y - 1]
'else [copy ""]
]
para: make para! [
align: pick [center right] header?
]
extra: object [
name: form ref
formula: old: none
]
actors: context [
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 f/data]]
]
]
on-focus: func [f e][
f/text: any [f/extra/formula f/text]
f/color: yello
]
]
]
]
]
view make face! [
type: 'window
text: "PicoSheets demo"
size: 840x250
pane: p
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment