Skip to content

Instantly share code, notes, and snippets.

@GiuseppeChillemi
Created September 14, 2023 17:49
Show Gist options
  • Save GiuseppeChillemi/90cd446df9dcf581f1d5a7c262ca9e62 to your computer and use it in GitHub Desktop.
Save GiuseppeChillemi/90cd446df9dcf581f1d5a7c262ca9e62 to your computer and use it in GitHub Desktop.
A script which hangs the event system
Red [
Title: "Red TUI merged test script"
Needs: 'View
Config: [GUI-engine: 'terminal]
Description: {
show an hang on the event system
}
]
page-3: layout/tight [
origin 2x1
text 24x2 center font-color yellow "Page 3" return
panel 30x2 [
bar: progress 20x1 30% rate 10 on-time [
data: face/data + 10%
face/data: either data > 100% [0%][data]
bar-txt/text: form face/data
bar-txt/font/color: random white
] pad 1x0
bar-txt: text 4x1 font-color white "30%"
] return
rich-text 40x3 transparent data [
yellow "Hello" red " Red " green "World!^/"
u "Underline" /u " " s "Strike" /s i " Italic" /i
] return
button 8x2 "Prev" [unview]
button 8x2 "Home" [show page-1]
button 4x2 "Quit" [unview/all]
]
page-2: layout/tight [
on-key [
switch event/key [
left [cat/offset: cat/offset - 1x0]
right [cat/offset: cat/offset + 1x0]
up [cat/offset: cat/offset - 0x1]
down [cat/offset: cat/offset + 0x1]
]
]
origin 1x1 space 1x1
text 10x1 font-color green "Page 2" return
text-list 13x3 select 2 data [
"1 apple"
"2 orange"
"3 banana"
"4 grape"
"5 lychee"
"6 pear"
"7 watermelon"
]
base 5x4 center middle "X^/Y"
base 5x4 wrap middle "abcdefgh" return
text 30x1 "Use arrow keys to move the cat" return
button 10x1 "Prev" [show page-1]
button 4x1 "Next" [show page-3]
cat: base transparent 2x1 "🐱"
]
page-1: layout/tight [
on-key [if event/key = #"^[" [unview/all]]
style txt: text 10x1 font-color 255.0.127
style field: field 10x1
style b3: base black 4x3
origin 1x1 space 1x1
panel 20x9 [
base 20x5 red wrap "I can eat glass, it does not hurt me^/^/ζˆ‘θƒ½εžδΈ‹ηŽ»η’ƒθ€ŒδΈδΌ€θΊ«δ½“" return
base 20x4 transparent draw [text 15x1 "~~~"]
{ __
(___()'`;
/, /`
\\"--\\}
]
panel 12x9 [
b3 blue left "πŸ˜€" b3 center "πŸ˜†" b3 green right "πŸ™‚" return
b3 middle "πŸ˜‚" b3 red middle center "😎" b3 middle right "😍" return
b3 green bottom left "πŸ˜›" b3 bottom center "πŸ˜‹" b3 blue bottom right "😭"
] return
panel 30x2 [
txt 13 "Card Number" return
field 19 hint "8888 **** **** 1234"
] return
panel 30x2 [
txt 8 "EXP" txt 3 "CVV" return
field 5 hint "MM/YY" pad 3x0 field 3 hint "999"
] return
button font-color gray 20x2 "Next ->" [show page-2]
]
view page-1
system/view/platform/mouse-event?: yes
view/tight [
on-key [if event/key = #"^[" [unview/all]]
origin 5x2 space 1x2
t: text 30x1 "(0, 0)" return
button 15x1 "mouse click me" [t/text: "click"] on-dbl-click [t/text: "double click"] return
base 30x5 all-over center middle "moving mouse on here"
on-over [t/text: rejoin [mold event/offset " " mold event/flags]]
on-down [t/text: rejoin ["mouse down " mold event/offset]]
on-up [t/text: rejoin ["mouse up " mold event/offset]]
on-mid-down [t/text: rejoin ["mouse mid down " mold event/offset]]
on-mid-up [t/text: rejoin ["mouse mid up " mold event/offset]]
on-alt-down [t/text: rejoin ["mouse alt down " mold event/offset]]
on-alt-up [t/text: rejoin ["mouse alt up " mold event/offset]]
on-wheel [t/text: rejoin ["mouse wheel " mold event/picked " " mold event/offset]]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment