Problem with Gtk::TreeViewColumn, sorting, and adding records?

Hi:

I worked for several hours today on a problem I’m having adding records
to a listview.model when its sorted.

I’m creating a model with a few columns including a String and and a
DateTime. I want to be able to sort on the DateTime column, so I set
the sort_column_id on the column:

id =

column.set_sort_func(id) { |iter1, iter2| iter1[id] <=> iter2[id] }
column.sort_column_id = id

That works fine, and I can add records at this point. However, I want
to have the list appear sorted on startup, so I add this line before any
records are added:

model.set_sort_column_id(id)

After, that statement is in place, I can’t add records without getting
this error on this line:

row = model.append
row[0] = anything

it says, “can’t convert nil to integer for the []= method.” Its
completely haywire inside Gtk. I’ve verified that all the objects are
valid.

The problem only occurs for the DateTime column, In fact, I reset the
model.set_sort_column_id to a String column or a pixbuf just so I can
add records then switch back when I’m done.

Its clearly a problem only when the active sort_column_id is set on the
DateTime column. I verified this because when I clicked on the String
col, then clicked to add records, it was fine. But when I clicked on
the DateTime col–whoops! So it doesn’t matter how the active
sort_column_id is set. But if its set to DateTime when you try to add
records, it causes the error.

Am I missing something?

Thanks all your help.

Eric

Hi

Could you provide minimal working code to test this behaviour/bug ?

Sorry for the delay. I tried that, but I couldn’t reproduce it. Just
getting the error takes many lines of code. I will work on it later
when I have time.

Thanks,
Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs