# Gtk::TreeViewColumn

**URL:** <https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648>\
**Category:** Ruby-Gnome 2\
**Created:** [February 9, 2012, 11:31pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648 "2012-02-09T23:31:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 9, 2012, 11:31pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/1 "2012-02-09T23:31:34Z")

</div>

## I’m still stuck with getting a undefined sort\_column\_id. For a GtkTreeViewColumn

irb(main):001:0\> require ‘gtk2’  
=\> true  
irb(main):002:0\> column = Gtk::TreeViewColumn.new  
=\> #\<Gtk::TreeViewColumn:0x29dbde8 ptr=0x2c32840\>  
irb(main):003:0\> column.sort\_column\_id = 1  
NoMethodError: undefined method `sort_column_id=' for #<Gtk::TreeViewColumn:0x29dbde8 ptr=0x2c32840> from (irb):3 from /myscratch/ruby/bin/irb:12:in`’

* * *

This works on older Ruby, and “the latest greatest” Ruby + Ruby/GTK

Just on this one machine I have built the interpreter on that is back  
to GTK 2.10

For reference, I am using this for my own “file selector” box, as I  
need to apply my own sort. This Gtk::TreeViewColumn is my file  
listing. I may not be using the best way to do it. But it seems odd it  
just fails on this one build. My build base was the latest(as of  
yesterday) snapshot of Ruby/GTK from Github.

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [February 11, 2012, 1:35am UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/2 "2012-02-11T01:35:52Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] Gtk::TreeViewColumn” on Thu, 9 Feb 2012  
15:30:47 -0700,  
grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m still stuck with getting a undefined sort\_column\_id. For a  
> GtkTreeViewColumn

Short answer: I’ve commited Gtk::TreeViewColumn#sort\_column\_id=  
support code on GTK+ 2.10 into master.

Long answer:

Ruby/GTK+ generates accessors from GObject’s property  
information automatically. For example, GtkTreeViewColumn  
(it’s a C level GObject) has the “sort-column-id” property:  
[http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#GtkTreeViewColumn--sort-column-id](http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#GtkTreeViewColumn--sort-column-id)

Ruby/GTK+ generates

- Gtk::TreeViewColumn#sort\_column\_id
- Gtk::TreeViewColumn#sort\_column\_id=
- Gtk::TreeViewColumn#set\_sort\_column\_id

from the property.

The above page says the “sort-column-id” property is defined  
“Since 2.18”. So you don’t have  
Gtk::TreeViewColumn#sort\_column\_id= with GTK+ 2.10.

I’ve added codes that accesse sort-column-id value by the  
following functions:

- gtk\_tree\_view\_column\_set\_sort\_column\_id()  
[http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#gtk-tree-view-column-set-sort-column-id](http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#gtk-tree-view-column-set-sort-column-id)
- gtk\_tree\_view\_column\_get\_sort\_column\_id()  
[http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#gtk-tree-view-column-get-sort-column-id](http://developer.gnome.org/gtk/stable/GtkTreeViewColumn.html#gtk-tree-view-column-get-sort-column-id)

Now you can use Gtk::TreeViewColumn#sort\_column\_id= with  
GTK+ 2.10.

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [March 12, 2012, 8:24pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/3 "2012-03-12T20:24:23Z")

</div>

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> 

Sorry for the long delay on reply. I just back to this. Thanks for the  
long  
answer. Explains a lot. I see you did two different commits.

The first one allowed me to do

thing.set\_sort\_column\_id(1)

But the next commit, that added the

RG\_DEF\_ALIAS(sort\_column\_id, set\_sort\_column\_id);

Gives me the compile error:  
rbgtktreeviewcolumn.c: In function ‘Init\_gtk\_treeviewcolumn’:  
rbgtktreeviewcolumn.c:294: error: ‘sort\_column\_id’ undeclared (first use  
in  
this function)  
rbgtktreeviewcolumn.c:294: error: (Each undeclared identifier is  
reported  
only once  
rbgtktreeviewcolumn.c:294: error: for each function it appears in.)  
rbgtktreeviewcolumn.c:294: error: ‘set\_sort\_column\_id’ undeclared (first  
use in this function)

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [March 14, 2012, 1:27pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/4 "2012-03-14T13:27:46Z")

</div>

Le 13 mars 2012 19:46, grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a crit :

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [March 13, 2012, 7:24pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/5 "2012-03-13T19:24:22Z")

</div>

Le 12 mars 2012 20:23, grant schoep [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a crit :

> > support code on GTK+ 2.10 into master.
> 
> use in this function)  
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,  
> Metro Style Apps, more. Free future releases when you subscribe now!  
> [http://p.sf.net/sfu/learndevnow-dev2](http://p.sf.net/sfu/learndevnow-dev2)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

Hello Kouhei, Grant

I believe it was easy to fix so I did it. Could you please check ?

---

<div class="post-metadata">

**Author:** ![grantspeelman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/da6949/32.png) [@grantspeelman](https://www.ruby-forum.com/u/grantspeelman)\
**Post date:** [March 14, 2012, 1:38pm UTC](https://www.ruby-forum.com/t/gtk-treeviewcolumn/216648/6 "2012-03-14T13:38:21Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Gtk::TreeViewColumn” on Tue, 13 Mar 2012  
19:23:30 +0100,  
Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I believe it was easy to fix so I did it. Could you please check ?

Thanks!!!  
It looks good for me too.

–  
kou
