对于nim语言,只有一个gui工具包为我工作,那就是gintro。
democode listview在我的netbsd上编译并运行良好。资料来源:http://ssalewski.de/gintroreadme.html
但我需要一个包含两列的listview(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 :)