有列名的一行行记录。
整张表一个焦点位置,↑ ↓ 换选中的行。
安装
组件以源码分发。把它和它依赖的文件拷进你的项目,再按需要改:
cargo run --release --bin amenui -- add table --to ../my-app拷贝的文件: src/widgets/table.rs, src/widgets/mod.rs
用法
use amenui::widgets::{table};
fn view() -> El<Msg> {
table("tb1", &[("名称", 120.0), ("大小", 60.0)], &[vec!["a.png".into(), "12 KB".into()], vec!["b.png".into(), "3 KB".into()]], Some(0), Msg::Pick)
}接口
| 函数 | table |
|---|---|
| 参数 | key, columns (name, width), rows (cells as text), selected, msg. |
| 文件 | src/widgets/table.rs |
| 依赖 | base |
| 对波前的响应 | nudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap) |
| 重组 | keyed labels recompose when their text changes |
键盘与无障碍
| 状态 | a selected row (highlighted); one focus stop, Up / Down move the selection. |
|---|---|
| 键盘与消息 | msg(i) on a row press or a key. |
在网页上,每个控件都在页面里有一个带角色和名字的镜像元素,读屏软件和浏览器自己的焦点都看得到它(DESIGN.md §1.14)。