Utoljára aktív 1733902543

yumaikas's Avatar yumaikas gist felülvizsgálása 1733902543. Revízióhoz ugrás

1 file changed, 61 insertions, 9 deletions

calc_numpad.nv

@@ -1,13 +1,14 @@
1 - | #strings, br, app, button,
1 + | #strings, br, app, button, calc-output, div,
2 2 AC, All Clear, C, Clear,
3 - 0,9,8,7,6,5,4,3,2,1, +,/,*,-,.,=,
4 - Press 7, Press 8, Press 9, Press Divide,
5 - Press 4, Press 5, Press 6, Press Multiply,
6 - Press 1, Press 2, Press 3, Press Subtract,
7 - Press 0, Press Dot, Press Equal, Press Add,
3 + 0,9,8,7,6,5,4,3,2,1,
4 + +,/,*,-,.,=,
5 + ,Press 7, Press 8, Press 9, Press Divide
6 + ,Press 4, Press 5, Press 6, Press Multiply
7 + ,Press 1, Press 2, Press 3, Press Subtract
8 + ,Press 0, Press Dot, Press Equal, Press Add
8 9 |
9 10
10 - | #slots, inner content, vera event |
11 + | #slots, DOM id, inner content, vera event, num A, num B |
11 12
12 13 | #port, on log string, needs, @on log, clears, @on log |
13 14 | #port, on clear log, needs, @clear log, clears, @clear log |
@@ -15,12 +16,19 @@ Press 0, Press Dot, Press Equal, Press Add,
15 16 | #port, create element, needs, @create element, clears, @create element |
16 17 | #port, mount element by id, needs, @mount element by id, clears, @mount element by id |
17 18
19 + |_| Works ased on the currently mounted element. Maybe a bit clunky, but works for now.
20 + | #port, clear element content, needs, @clear element content, clears, @clear element content |
21 + | #port, append string to element, needs, @append string to element, clears, @append string to element |
22 +
23 +
18 24 || ui init
19 25
20 26 | ui init |
21 27 @reset ui,
22 28 add string app, mount element by id,
23 - create buttons
29 + create display label,
30 + create buttons,
31 + mount to output,
24 32
25 33 | create button |
26 34 set slot inner content,
@@ -36,6 +44,14 @@ Press 0, Press Dot, Press Equal, Press Add,
36 44 | create element | @create element
37 45 | mount element by id | @mount element by id
38 46
47 + | create display label |
48 + add string calc-output, set DOM id, create display label.2,
49 + | set DOM id | set slot DOM id
50 + | create display label.2 |
51 + add string div, create element, finish label row
52 +
53 + | finish label row | next row
54 +
39 55 | create buttons |
40 56 create AC C row,
41 57 create 7 8 9 / row,
@@ -72,12 +88,48 @@ Press 0, Press Dot, Press Equal, Press Add,
72 88 |123 Finish| next row
73 89
74 90
75 - |create 0 . = +| add button 0, add button ., add button =, add button +
91 + | create 0 . = + | add button 0, add button ., add button =, add button +
76 92 | add button 0 | add string 0, add string Press 0, create button
77 93 | add button . | add string ., add string Press Dot, create button
78 94 | add button = | add string =, add string Press Equal, create button
79 95 | add button + | add string +, add string Press Add, create button
80 96
97 + | mount to output | add string calc-output, mount element by id
98 +
81 99 | Clear | add string Clear, on log
82 100
83 101 | on log | @on log
102 +
103 + | add char | string append, ac.1, display acc
104 + | ac.1 | set slot acc
105 +
106 + | display acc | dc.1
107 + | dc.1 | dc.2, clear element content
108 + | dc.2 | dc.3, fetch slot acc
109 + | dc.3 | @append string to element
110 +
111 + | Number Button Pressed | mount to output, fetch slot acc, get button char, Finish Number Button Press
112 + | get button char, b0 | add string 0
113 + | get button char, b1 | add string 1
114 + | get button char, b2 | add string 2
115 + | get button char, b3 | add string 3
116 + | get button char, b4 | add string 4
117 + | get button char, b5 | add string 5
118 + | get button char, b6 | add string 6
119 + | get button char, b7 | add string 7
120 + | get button char, b8 | add string 8
121 + | get button char, b9 | add string 9
122 + | get button char, b. | add string .
123 + | Finish Number Button Press | add char
124 +
125 + | Press 0 | Number Button Pressed, b0
126 + | Press 1 | Number Button Pressed, b1
127 + | Press 2 | Number Button Pressed, b2
128 + | Press 3 | Number Button Pressed, b3
129 + | Press 4 | Number Button Pressed, b4
130 + | Press 5 | Number Button Pressed, b5
131 + | Press 6 | Number Button Pressed, b6
132 + | Press 7 | Number Button Pressed, b7
133 + | Press 8 | Number Button Pressed, b8
134 + | Press 9 | Number Button Pressed, b9
135 + | Press Dot | Number Button Pressed, b.

yumaikas's Avatar yumaikas gist felülvizsgálása 1733863279. Revízióhoz ugrás

1 file changed, 83 insertions

calc_numpad.nv(fájl létrehozva)

@@ -0,0 +1,83 @@
1 + | #strings, br, app, button,
2 + AC, All Clear, C, Clear,
3 + 0,9,8,7,6,5,4,3,2,1, +,/,*,-,.,=,
4 + Press 7, Press 8, Press 9, Press Divide,
5 + Press 4, Press 5, Press 6, Press Multiply,
6 + Press 1, Press 2, Press 3, Press Subtract,
7 + Press 0, Press Dot, Press Equal, Press Add,
8 + |
9 +
10 + | #slots, inner content, vera event |
11 +
12 + | #port, on log string, needs, @on log, clears, @on log |
13 + | #port, on clear log, needs, @clear log, clears, @clear log |
14 + | #port, on reset ui, needs, @reset ui, clears, @reset ui |
15 + | #port, create element, needs, @create element, clears, @create element |
16 + | #port, mount element by id, needs, @mount element by id, clears, @mount element by id |
17 +
18 + || ui init
19 +
20 + | ui init |
21 + @reset ui,
22 + add string app, mount element by id,
23 + create buttons
24 +
25 + | create button |
26 + set slot inner content,
27 + set slot vera event,
28 + create button.2
29 +
30 + | create button.2 |
31 + add string button, create element
32 +
33 + | next row |
34 + add string br, create element
35 +
36 + | create element | @create element
37 + | mount element by id | @mount element by id
38 +
39 + | create buttons |
40 + create AC C row,
41 + create 7 8 9 / row,
42 + create 4 5 6 * row,
43 + create 1 2 3 - row,
44 + create 0 . = +
45 +
46 + | create AC C row | create AC button, create C button
47 + | create AC button | add string AC, add string All Clear, create button
48 + | create C button | add string C, add string Clear, create button, ACC finish
49 + |ACC finish| next row
50 +
51 + | create 7 8 9 / row | add button 7, add button 8, add button 9, add button /
52 + | add button 7 | add string 7, add string Press 7, create button
53 + | add button 8 | add string 8, add string Press 8, create button
54 + | add button 9 | add string 9, add string Press 9, create button
55 + | add button / | add string /, add string Press Divide, create button, 789 Finish
56 + |789 Finish| next row
57 +
58 +
59 + | create 4 5 6 * row | add button 4, add button 5, add button 6, add button *
60 + | add button 4 | add string 4, add string Press 4, create button
61 + | add button 5 | add string 5, add string Press 5, create button
62 + | add button 6 | add string 6, add string Press 6, create button,
63 + | add button * | add string *, add string Press Multiply, create button, 456 Finish
64 + |456 Finish| next row
65 +
66 + | create 1 2 3 - row | add button 1, add button 2, add button 3, add button -
67 +
68 + | add button 1 | add string 1, add string Press 1, create button
69 + | add button 2 | add string 2, add string Press 2, create button
70 + | add button 3 | add string 3, add string Press 3, create button
71 + | add button - | add string -, add string Press Subtract, create button, 123 Finish
72 + |123 Finish| next row
73 +
74 +
75 + |create 0 . = +| add button 0, add button ., add button =, add button +
76 + | add button 0 | add string 0, add string Press 0, create button
77 + | add button . | add string ., add string Press Dot, create button
78 + | add button = | add string =, add string Press Equal, create button
79 + | add button + | add string +, add string Press Add, create button
80 +
81 + | Clear | add string Clear, on log
82 +
83 + | on log | @on log
Újabb Régebbi