From 3182eb011242e424ce90f50eb586db8d701dd7d7 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 8 Apr 2024 15:25:04 +0400 Subject: [PATCH] Add clarification about on_settings callback --- README.md | 8 ++++++++ samples/search-settings-test.lua | 19 ------------------- 2 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 samples/search-settings-test.lua diff --git a/README.md b/README.md index 6f58d3b..cc9399f 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,14 @@ function on_action() end ``` +To change the action of the settings icon in the widget's edit menu, you can add the on_settings() function to the script. It will be called every time the user presses the icon. + +``` +function on_action() + ui:show_toast("Settings icon clicked!") +end +``` + ## Application management * `apps:apps([sort_by])` - returns the table of tables of all installed applications; diff --git a/samples/search-settings-test.lua b/samples/search-settings-test.lua deleted file mode 100644 index d3a8d8b..0000000 --- a/samples/search-settings-test.lua +++ /dev/null @@ -1,19 +0,0 @@ --- type = "search" - -settings_init = false - -function on_search() - if not settings_init then - search:show_buttons{ "Set settings" } - else - search:show_buttons{ "Result #1", "Result #2" } - end -end - -function on_click(idx) - if not settings_init then - settings:show_dialog() - else - -- main work - end -end