-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemosGuiRunner.red
40 lines (36 loc) · 1.1 KB
/
demosGuiRunner.red
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Red [
Title: "demo Gui runner"
Authors: "renaudG"
Goal: "provide a GUI runner for demos"
File: %simpleDraw4.red
Tabs: 4
Rights: ""
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}
needs: 'view
]
samples: load https://raw.githubusercontent.com/nodrygo/DemosRed/master/demopath.red
;;append samples ["Boucing ball" %/Z/devygo/red/win/DemosRed/simpleDraw/ballbounce.red]
choose: func [n] [
x: samples/(2 * n)
source: read x
size: 0x15 * (length? split source "^/") + 500x00
reduce [source size]
]
menu: []
foreach [title url] samples [ append menu title ]
view [
drop-down 400 data menu on-change [
psize: face/parent/size - ed/size
r: choose face/selected
ed/text: r/1
ed/size: r/2
b/enable?: true
face/parent/size: psize + r/2
]
b: button 80 "RUN" disabled [attempt [do ed/text]]
return
ed: text 500x100 255.255.255 "Choose your sample above, then run it if you wish."
]