[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Question about Treeview/SimpleList



Jaap Karssenberg said:
> I use Gtk2::SimpleList to create a table (using rc3 with glade and
> "new_from_treeview"), now what I would *really* like is to be able to
> click a column header to sort the data sets (rows) according to the
> fiels in that column.
>
> I got the headers to be clickable, but no clue how to get a reference to
> connect signals to. I would expect a syntax like
>  $SimpleLIst->get_header($n)->signal_connect(clicked => \&sort_data)
> but it doesn't seem to be there.
>
> Would anyone be so kind to enlight me on how to do this ?

disclaimer: i haven't actually done this, i'm just looking through the docs
for what looks like the relevant stuff given what i know about treeview.


some combination of $treeview->get_column(index) or $treeview->get_columns
will get you the column object(s) of interest.

if i'm reading correctly, $column->set_sort_column_id () will do what you
want, without the need to set up callbacks and such.

if not, you can call $column->set_clickable to make the column clickable, and
connect something to the clicked signal on $column.  from that signal handler
you'd use set_sort_indicator and set_sort_order, yadda yadda yadda.



http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-get-column

http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-sort-column-id

http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-clickable

http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-sort-indicator

http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeViewColumn.html#gtk-tree-view-column-set-sort-order

-- 
muppet <scott at asofyet dot org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]