gtk3 - nim 语言,gintro 演示,在 listview / gtktreeview 中有两列,可排序
问题描述
对于 nim 语言,只有一个 gui 工具包对我有用,那就是 gintro。
演示代码列表视图在我的 netbsd 上编译并运行良好。资料来源: http ://ssalewski.de/gintroreadme.html
但是我需要一个包含两列的列表视图(gtktreeview),我查看了 nim.gtk 但无法弄清楚我应该拼写哪些“演员”。
演示程序中的代码:
let gtype = typeFromName("gchararray")
let store = newListStore(N_COLUMNS, cast[pointer]( unsafeaddr gtype))
# cast due to bug in gtk.nim
适用于N_COLUMNS=1
但不适用N_COLUMNS:2
这是 nim.gtk 中的相关部分:
proc newListStore*(nColumns: int; types: GTypeArray): ListStore =
let gobj = gtk_list_store_newv(int32(nColumns), types)
其次,当我有多个列时,我想通过单击标题使其可排序(如 Excel 表)
解决方案
我认为你需要这样的东西:
let gtypes = [typeFromName("gchararray"), typeFromName("gchararray")] # Be sure to change the types to whatever you need.
let store = newListStore(N_COLUMNS, addr gtype[0]) # You shouldn't need this weird cast here.
未经测试,但应该可以工作。如果您需要更多帮助,请随时加入我们的 Gitter/IRC :)
推荐阅读
- java - 如何从文本中删除包含破折号的单词?
- python - 使用 Keras 跑步时的形状问题
- reactjs - 你如何在 React 中使用 Swiper 回调方法?
- javascript - 所选项目JS的按钮功能
- machine-learning - 确定批量输入形状
- express - Nestjs start 在模块初始化中静默失败
- swift - SwiftUI - 按下按钮动画视图
- r - mutate(across(contains("column") 在存储列名后对每一列进行额外修改
- java - 为什么我不能在模型(MVC 模式)中使用“this”?
- vim - 在vim中搜索并替换为增量