表格(Grid)
表格控件可让用户在表格中插入行、列、文本。
- Gird
属性
属性 | 描述 |
---|---|
列数量/行数量(ColCount/RowCount) | 用于设置当前控件的列数量/行数量 |
是否显示表头行/列(RowHeaderVisible/ColHeaderVisible) | 用于设置当前控件是否显示表头行/列 |
设置表格内的文本 (SetGridText(int row, int col, wstring text)) | 用于设置表格内的文本 |
事件
回调名称 | 回调函数 |
---|---|
on_select_grid | 鼠标左键点击格子的回调 |
on_select_row | 鼠标左键选择行时的回调 |
on_select_col | 鼠标左键选择列时的回调 |
Lua 脚本示例
self.RowHeaderVisible = true
self.ColHeaderVisible = true
self.ColCount = 6
self.RowCount = 6
self:SetRowTitle(0, nx_widestr("1"))
self:SetRowTitle(1, nx_widestr("2"))
self:SetColTitle(0, nx_widestr("1"))
self:SetColTitle(1, nx_widestr("2"))
self:SetGridText(0, 0, nx_widestr("Text"))
-- 鼠标左键点击格子时,就会执行 Grid_select_grid 的回调函数
function Grid_select_grid(self)
nx_msgbox("Grid_select_grid")
end