-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo_button
executable file
·46 lines (40 loc) · 932 Bytes
/
demo_button
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
41
42
43
44
45
46
#!/bin/bash
source bashui
mess="RESULT"
name="The Button"
title="Push the button, will get a result..."
butt(){
# Create default button to copy
#1 X(row) coordinate
#2 Y(line) coordinate
#3 Button name
#4 Function to run
#5 Text color
#6 Border color
#7 Background color
local x=$((COLUMNS/2-(${#name}/2+2)))
local y=$((LINES/2))
# 1 2 3 4 5 6 7
button $x $y "$name" "result" "$wht" "$ylw" "$bblk"
}
result(){
local x=$((COLUMNS/2-${#mess}/2))
local y=$((LINES/2+5))
XY $x $y "$mess"
(sleep 1; XY $x $y "${mess//[[:print:]]/ }") &
}
menu(){
cursor off
default_button butt
XY $((COLUMNS/2-${#title}/2)) $((LINES/2-2)) "$title"
butt
while true; do
read_input
case $_input_ in
enter ) press_button butt;;
escape) return;;
esac
done
}
clear
menu