TreeView + Updating list on mouse-click of header


#1

Hi there,

I am using TreeView to display list store data

This works fine.

However, I want that, if you click on the header,
the list store to update and sort alphabetically.

My problem is - there seems to be no event possible
when you click on that header?

Example of my widget:


Name Age Profession


joe | 51 | C# Coder
tim | 31 | Python Coder
pete | 25 | Ruby C.
| |
| |
| |

And I want to update the listings whenever
someone clicks on “Age” or “Profession”
in that header, inserted via

tree_view.insert_column(-1, ‘Age’, renderer, :text => 1)
tree_view.insert_column(-1, ‘Profession’, renderer, :text => 2)


Search for products and services at:
http://search.mail.com

Powered by Outblaze


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#2

Hi,

In removed_email_address@domain.invalid
“[ruby-gnome2-devel-en] TreeView + Updating list on mouse-click of
header” on Fri, 05 Jan 2007 02:02:03 +0100,
“Roebe XXX” removed_email_address@domain.invalid wrote:

My problem is - there seems to be no event possible
when you click on that header?

And I want to update the listings whenever
someone clicks on “Age” or “Profession”
in that header, inserted via

tree_view.insert_column(-1, ‘Age’, renderer, :text => 1)
tree_view.insert_column(-1, ‘Profession’, renderer, :text => 2)

You can’t. Use the following way instead of your way:

column = Gtk::TreeViewColumn.new('Age, renderer, :text => 1)
column.set_sort_column_id(1)
tree_view.append_column(column)

This sample source will help you:
http://ruby-gnome2.cvs.sourceforge.net/ruby-gnome2/ruby-gnome2/gtk/sample/gtk-demo/list_store.rb?revision=HEAD&view=markup

Thanks,

kou


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV