@@ -75,6 +75,13 @@ int main() {
7575 " }"
7676 " h1 { text-shadow: -7px 10px 7px rgb(67 57 57 / 76%); }"
7777 " button:hover { background: #c9913d; }"
78+ " button:disabled {"
79+ " opacity: 0.6;"
80+ " cursor: not-allowed;"
81+ " box-shadow: none;"
82+ " filter: grayscale(30%);"
83+ " }"
84+ " button:disabled:hover { background: #3498db; }"
7885 " input:focus { outline: none; border-color: #3498db; }"
7986 " </style>"
8087 " </head>"
@@ -83,13 +90,14 @@ int main() {
8390 " <br>"
8491 " <h1 id=\"count\">0</h1>"
8592 " <br>"
86- " <button OnClick=\"my_function_count();\">Manual Count</button>"
93+ " <button id=\"ManualBtn\" OnClick=\"my_function_count();\">Manual Count</button>"
8794 " <br>"
8895 " <button id=\"MyTest\" OnClick=\"AutoTest();\">Auto Count (Every 10ms)</button>"
8996 " <br>"
90- " <button OnClick=\"my_function_exit();\">Exit</button>"
97+ " <button id=\"ExitBtn\" OnClick=\"this.disabled=true; my_function_exit();\">Exit</button>"
9198 " <script>"
9299 " let count = 0;"
100+ " let auto_running = false;"
93101 " function GetCount() {"
94102 " return count;"
95103 " }"
@@ -98,12 +106,19 @@ int main() {
98106 " count = number;"
99107 " }"
100108 " function AutoTest(number) {"
109+ " if (auto_running) return;"
110+ " auto_running = true;"
111+ " document.getElementById('MyTest').disabled = true;"
112+ " document.getElementById('ManualBtn').disabled = true;"
101113 " setInterval(function(){ my_function_count(); }, 10);"
102114 " }"
103115 " </script>"
104116 " </body>"
105117 "</html>" ;
106118
119+ // Set WebUI configuration to proceess UI events one at a time
120+ webui_set_config (ui_event_blocking , true);
121+
107122 // Create a window
108123 size_t my_window = webui_new_window ();
109124
0 commit comments