0

For nim language there is only one gui toolkit working for me and that is gintro.

The democode listview compiles and runs nice on my netbsd. Source: http://ssalewski.de/gintroreadme.html

But I need a listview(gtktreeview) with two columns, I looked into nim.gtk but can't figure out which "casts" I should spell.

The code in the demo program:

let gtype = typeFromName("gchararray")
let store = newListStore(N_COLUMNS, cast[pointer]( unsafeaddr gtype)) 
# cast due to bug in gtk.nim

Works nice for N_COLUMNS=1 but not N_COLUMNS:2

Here is the relevant part in nim.gtk:

proc newListStore*(nColumns: int; types: GTypeArray): ListStore =
    let gobj = gtk_list_store_newv(int32(nColumns), types)

Second when I have multiple colums I would like to make it sortable by clicking on the header (like an excel table)

barbsan
  • 3,418
  • 11
  • 21
  • 28

1 Answers1

1

I think you need something like this:

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.

Untested but should work. Feel free to join our Gitter/IRC if you need more help :)

dom96
  • 1,012
  • 1
  • 9
  • 22