Add info and sample for set_edit_mode_button function

This commit is contained in:
Evgeny
2025-01-08 14:13:29 +08:00
parent d2651f22cb
commit 0922b1f2b7
2 changed files with 16 additions and 1 deletions

View File

@@ -25,6 +25,10 @@ The type of script is determined by the line (meta tag) at the beginning of the
# Changelog # Changelog
### 5.6.0
* Added `ui:set_edit_mode_buttons()` method
### 5.5.4 ### 5.5.4
* Added `icon` meta tag * Added `icon` meta tag
@@ -128,7 +132,8 @@ _AIO Launcher also offers a way to create more complex UIs: [instructions](READM
* `ui:set_title()` - changes the title of the widget, should be called before the data display function (empty line - reset to the standard title); * `ui:set_title()` - changes the title of the widget, should be called before the data display function (empty line - reset to the standard title);
* `ui:set_folding_flag(boolean)` - sets the flag of the folded mode of the widget, the function should be called before the data display functions; * `ui:set_folding_flag(boolean)` - sets the flag of the folded mode of the widget, the function should be called before the data display functions;
* `ui:folding_flag()` - returns folding flag; * `ui:folding_flag()` - returns folding flag;
* `ui:set_progress(float)` - sets current widget progress (like in Player and Health widgets). * `ui:set_progress(float)` - sets current widget progress (like in Player and Health widgets);
* `ui:set_edit_mode_buttons(table)` - adds icons listed in the table (formatted as `"fa:name"`) to the edit mode. When an icon is clicked, the function `on_edit_mode_button_click(index)` will be called.
The `ui:show_chart()` function takes a string as its third argument to format the x and y values on the screen. For example, the string `x: date y: number` means that the X-axis values should be formatted as dates, and the Y-values should be formatted as a regular number. There are four formats in total: The `ui:show_chart()` function takes a string as its third argument to format the x and y values on the screen. For example, the string `x: date y: number` means that the X-axis values should be formatted as dates, and the Y-values should be formatted as a regular number. There are four formats in total:

View File

@@ -0,0 +1,10 @@
edit_mode_buttons = { "fa:home", "fa:heart", "fa:gamepad" }
function on_resume()
ui:set_edit_mode_buttons(edit_mode_buttons)
ui:show_text("Swipe to ppen edit mode")
end
function on_edit_mode_button_click(idx)
ui:show_toast(edit_mode_buttons[idx])
end