[gtkmm] Re: Treeview help needed... I got it!



Hello there;
Just wanted to thank everyone for your participation in helping me out with the treview stuff.
I would confess mine works perfect... Just the way I hoped.
I hope Thun's stuff is working too.
Have great weekend y'all, I know I will!
Sincerely
David

Send gtkmm-list mailing list submissions to
	gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
	gtkmm-list-request gnome org

You can reach the person managing the list at
	gtkmm-list-admin gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

  1. RE: Using Gtkmm and Glade under Windows (Laughlin, Joseph V)
  2. Re: Treeview help needed (Andreas B. Thun)
  3. Re: Treeview help needed (Simon Fuhrmann)
  4. Re: Treeview help needed (Andreas B. Thun)
  5. Re: Treeview help needed (bart)
  6. Re: Treeview help needed (treeview/list/examplewindow.cc) (Andreas B. Thun)
  7. Re: Treeview help needed (Andreas B. Thun)
  8. Re: Treeview help needed (bart)
  9. Re: Treeview help needed (Andreas B. Thun)
 10. Re: Treeview help needed (bart)
 11. Re: Treeview help needed (Andreas B. Thun)
 12. Re: Treeview help needed (Christer Palm)
 13. Re: Treeview help needed (Andreas B. Thun)

--__--__--

Message: 1
Subject: RE: [gtkmm] Using Gtkmm and Glade under Windows
Date: Thu, 15 Apr 2004 09:28:25 -0700
From: "Laughlin, Joseph V" <Joseph V Laughlin boeing com>
To: "Roger Leigh" <roger whinlatter uklinux net>,
	"Carlos Augusto Lains Leitao" <carlos_leitao hotmail com>
Cc: <gtkmm-list gnome org>

PE-COFF?

Joe Laughlin

-----Original Message-----
From: Roger Leigh [mailto:roger whinlatter uklinux net]=20
Sent: Thursday, April 15, 2004 8:33 AM
To: Carlos Augusto Lains Leitao
Cc: gtkmm-list gnome org
Subject: Re: [gtkmm] Using Gtkmm and Glade under Windows

"Carlos Augusto Lains Leitao" <carlos_leitao hotmail com> writes:

  I=B4m new on gtkmm and glade and i would like to know if anyone =
could
tell me if i can import .glade archives on windows aplications using
gtkmm with the libglade library, if anyone could help me i would be
vry glad...

I'm not entirely sure what you mean in your question by "importing
archives".  However, Gtkmm and libglade(mm) work identically on
Windows as on Linux/Unix.  The only exception I've found is that
glade_xml_signal_autoconnect() won't work due to PE-COFF not allowing
executables to have a dynamic symbol table.  This is not an issue if
you are using Gtkmm, since libglademm can't use that functionality
with libsigc++ anyway.


--=20
Roger Leigh

               Printing on GNU/Linux?  =
http://gimp-print.sourceforge.net/
               GPG Public Key: 0x25BFB848.  Please sign and encrypt =
your mail.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

--__--__--

Message: 2
Date: Thu, 15 Apr 2004 19:33:50 +0200
From: "Andreas B. Thun" <abt gmx de>
To: Christer Palm <palm nogui se>
Cc: David Kinyanjui <david i2software com>, bart <gtkmm hakvoort be>,
	gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed

Hi members,

I´ve tried with my list view but the headers are
not clickable at all. Any hints?

  m_list_store_ref = Gtk::ListStore::create(m_columns);
  m_list_store_ref->set_sort_column_id(1, Gtk::SORT_ASCENDING);  // <---------
  m_tree_view.set_model(m_list_store_ref);
  m_tree_view.set_headers_clickable();  // <---------



*.h:

	// TreeView of the columned list
	Gtk::TreeView m_tree_view;

	// TreeModel of the columned list
	Glib::RefPtr<Gtk::ListStore> m_list_store_ref;

        // Selection in current TreeView
	Glib::RefPtr<Gtk::TreeSelection> m_tree_sel_ref;


No need to handle that signal is all you want is beeing able to control the sorting by clicking on the column headers, though. That is handled automatically by the TreeView once you activate sorting.

For sorting use something like this:

treestore->set_sort_column_id(<your column to sort>,
Gtk::SORT_ASCENDING);


--__--__--

Message: 3
From: "Simon Fuhrmann" <NightSlayer gmx de>
To: "Andreas B. Thun" <abt gmx de>, "Christer Palm" <palm nogui se>
Cc: "David Kinyanjui" <david i2software com>, <gtkmm-list gnome org>
Subject: Re: [gtkmm] Treeview help needed
Date: Thu, 15 Apr 2004 22:17:33 +0200

Hi!

I haven't followed this thread but maybe it helps.

I´ve tried with my list view but the headers are
not clickable at all. Any hints?

  m_list_store_ref = Gtk::ListStore::create(m_columns);
  m_list_store_ref->set_sort_column_id(1, Gtk::SORT_ASCENDING);  //
<---------
  m_tree_view.set_model(m_list_store_ref);
  m_tree_view.set_headers_clickable();  // <---------

I can't see code where you add the Gtk::TreeView::Column's. Try to use this
methode

 int append_column (TreeViewColumn& column)

with your tree model column as parameter before you call
set_headers_visible(). You may want to try to pass `true´ explictly to
set_headers_clickable(), but that shouldn't be neccessary.

Regards,
Simon Fuhrmann


--__--__--

Message: 4
Date: Thu, 15 Apr 2004 22:16:45 +0200
From: "Andreas B. Thun" <abt gmx de>
To: Simon Fuhrmann <NightSlayer gmx de>
Cc: Christer Palm <palm nogui se>,
	David Kinyanjui <david i2software com>, gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed

Hi Simon, thx for your help.

I forgot to mention that my table is displayed correctly and
of course I have methodes like:


void ConstraintTable::addHeaderColumns()
{
  m_tree_view.append_column(gettext("Active"),      m_columns.m_col_active);
  m_tree_view.append_column(gettext("Type"),        m_columns.m_col_type);
  m_tree_view.append_column(gettext("ID"),          m_columns.m_col_id);
  m_tree_view.append_column(gettext("Elements"),    m_columns.m_col_elements);
  m_tree_view.append_column(gettext("Description"), m_columns.m_col_description);
}


void ConstraintTable::addRow(const VecRow_t& lineData)
{
  // Add lineData
  Gtk::TreeModel::iterator iter = m_list_store_ref->append();
  row_t row = *iter;
  row [m_columns.m_col_active]      = lineData[0];
  row [m_columns.m_col_type]        = lineData[1];
  row [m_columns.m_col_id]          = lineData[2];
  row [m_columns.m_col_elements]    = lineData[3];
  row [m_columns.m_col_description] = lineData[4];
}


Simon Fuhrmann wrote:
I can't see code where you add the Gtk::TreeView::Column's. Try to use this
methode



--__--__--

Message: 5
Subject: Re: [gtkmm] Treeview help needed
From: bart <gtkmm hakvoort be>
To: "Andreas B. Thun" <abt gmx de>
Cc: Simon Fuhrmann <NightSlayer gmx de>,
	Christer Palm <palm nogui se>,
	David Kinyanjui <david i2software com>, gtkmm-list gnome org
Date: Thu, 15 Apr 2004 22:38:05 +0200

Hi,

Don't know in which order you do things. But to make the headers
clickable you need to call set_headers_clickable() *AFTER* you've
appended the columns.

grtz,

Bart

On Thu, 2004-04-15 at 22:16, Andreas B. Thun wrote:
Hi Simon, thx for your help.

I forgot to mention that my table is displayed correctly and
of course I have methodes like:


void ConstraintTable::addHeaderColumns()
{
  m_tree_view.append_column(gettext("Active"),      m_columns.m_col_active);
  m_tree_view.append_column(gettext("Type"),        m_columns.m_col_type);
  m_tree_view.append_column(gettext("ID"),          m_columns.m_col_id);
  m_tree_view.append_column(gettext("Elements"),    m_columns.m_col_elements);
  m_tree_view.append_column(gettext("Description"), m_columns.m_col_description);
}


void ConstraintTable::addRow(const VecRow_t& lineData)
{
  // Add lineData
  Gtk::TreeModel::iterator iter = m_list_store_ref->append();
  row_t row = *iter;
  row [m_columns.m_col_active]      = lineData[0];
  row [m_columns.m_col_type]        = lineData[1];
  row [m_columns.m_col_id]          = lineData[2];
  row [m_columns.m_col_elements]    = lineData[3];
  row [m_columns.m_col_description] = lineData[4];
}


Simon Fuhrmann wrote:
I can't see code where you add the Gtk::TreeView::Column's. Try to use this
methode
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


--__--__--

Message: 6
Date: Thu, 15 Apr 2004 22:36:55 +0200
From: "Andreas B. Thun" <abt gmx de>
To: Simon Fuhrmann <NightSlayer gmx de>
Cc: Christer Palm <palm nogui se>,
	David Kinyanjui <david i2software com>, gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed (treeview/list/examplewindow.cc)

To make it more easy I modified the treeview/list/examplewindow.cc
example.

I just add a m_TreeView.set_headers_clickable(true) in line 49
and the effect is the same! I cannot click the headers. They
are just static.

btw: I use SuSE Linux 9.0.


--__--__--

Message: 7
Date: Thu, 15 Apr 2004 22:47:01 +0200
From: "Andreas B. Thun" <abt gmx de>
To: bart <gtkmm hakvoort be>
Cc: Simon Fuhrmann <NightSlayer gmx de>,
	Christer Palm <palm nogui se>,
	David Kinyanjui <david i2software com>, gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed

*Bingo!* Thx Bart! Finally, they are reacting.

Don't know in which order you do things. But to make the headers
clickable you need to call set_headers_clickable() *AFTER* you've
appended the columns.

Sorting is not working, though.
What must I do to get this nice behaviour that every column is sorted
by the column header when I click the header?


I append cols with:

m_tree_view.append_column(gettext("Active"),      m_columns.m_col_active);
m_tree_view.append_column(gettext("Type"),        m_columns.m_col_type);
m_tree_view.append_column(gettext("ID"),          m_columns.m_col_id);
m_tree_view.append_column(gettext("Elements"),    m_columns.m_col_elements);
m_tree_view.append_column(gettext("Description"), m_columns.m_col_description);



m_list_store_ref->set_sort_column_id(1, Gtk::SORT_ASCENDING);

does not do anything for me ...


--__--__--

Message: 8
Subject: Re: [gtkmm] Treeview help needed
From: bart <gtkmm hakvoort be>
To: "Andreas B. Thun" <abt gmx de>
Cc: Simon Fuhrmann <NightSlayer gmx de>,
	Christer Palm <palm nogui se>,
	David Kinyanjui <david i2software com>, gtkmm-list gnome org
Date: Thu, 15 Apr 2004 22:53:49 +0200

I don't think it'll wors by just passing "1" as an argument. Try passing
a Gtk::TreeViewColumn.

-------------------------------------------------------
Gtk::TreeViewColumn *column = get_column(0);
m_list_store_ref->set_sort_column_id(column, Gtk::SORT_ASCENDING);
-----------------------------------------------------------

Bart


On Thu, 2004-04-15 at 22:47, Andreas B. Thun wrote:
*Bingo!* Thx Bart! Finally, they are reacting.

Don't know in which order you do things. But to make the headers
clickable you need to call set_headers_clickable() *AFTER* you've
appended the columns.
Sorting is not working, though.
What must I do to get this nice behaviour that every column is sorted
by the column header when I click the header?


I append cols with:

m_tree_view.append_column(gettext("Active"),      m_columns.m_col_active);
m_tree_view.append_column(gettext("Type"),        m_columns.m_col_type);
m_tree_view.append_column(gettext("ID"),          m_columns.m_col_id);
m_tree_view.append_column(gettext("Elements"),    m_columns.m_col_elements);
m_tree_view.append_column(gettext("Description"), m_columns.m_col_description);



m_list_store_ref->set_sort_column_id(1, Gtk::SORT_ASCENDING);

does not do anything for me ...



--__--__--

Message: 9
Date: Thu, 15 Apr 2004 23:32:28 +0200
From: "Andreas B. Thun" <abt gmx de>
To: bart <gtkmm hakvoort be>
Cc: gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed


I don't think it'll wors by just passing "1" as an argument. Try passing
a Gtk::TreeViewColumn.

Yes, you are right. It sorts by the column and that´s it.
It does not matter which header I click on.

So I tried this but it does not work.
I have the feeling that I have to connect callbacks to the
headers ... somehow?


  m_list_store_ref = Gtk::ListStore::create(m_columns);

  m_list_store_ref->set_sort_column_id(m_columns.m_col_active,      Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_type,        Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_id,          Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_elements,    Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_description, Gtk::SORT_ASCENDING);

  m_tree_view.set_model(m_list_store_ref);



.h:

	// Tree model columns:
	class ModelColumnsTAB : public Gtk::TreeModel::ColumnRecord
	{
	public:
	  ModelColumnsTAB()
	  {
		add(m_col_active);
		add(m_col_type);
		add(m_col_id);
		add(m_col_elements);
		add(m_col_description);
	  }
	  Gtk::TreeModelColumn<Glib::ustring> m_col_active;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_type;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_id;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_elements;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_description;
	};
	const ModelColumnsTAB m_columns;


--__--__--

Message: 10
Subject: Re: [gtkmm] Treeview help needed
From: bart <gtkmm hakvoort be>
To: "Andreas B. Thun" <abt gmx de>
Cc: gtkmm-list gnome org
Date: Thu, 15 Apr 2004 23:37:58 +0200

Hi andreas,

You have to connect some callbacks indeed. take a look at
Gtk::TreeViewColumn::signal_clicked()
This always works for me, but if i'm not mistaken Christer mentioned
another way of accomplishing this. So i'd like to hear more ;-)

grtz,

Bart

On Thu, 2004-04-15 at 23:32, Andreas B. Thun wrote:
I don't think it'll wors by just passing "1" as an argument. Try passing
a Gtk::TreeViewColumn.
Yes, you are right. It sorts by the column and that´s it.
It does not matter which header I click on.

So I tried this but it does not work.
I have the feeling that I have to connect callbacks to the
headers ... somehow?


  m_list_store_ref = Gtk::ListStore::create(m_columns);

  m_list_store_ref->set_sort_column_id(m_columns.m_col_active,      Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_type,        Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_id,          Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_elements,    Gtk::SORT_ASCENDING);
  m_list_store_ref->set_sort_column_id(m_columns.m_col_description, Gtk::SORT_ASCENDING);

  m_tree_view.set_model(m_list_store_ref);



.h:

	// Tree model columns:
	class ModelColumnsTAB : public Gtk::TreeModel::ColumnRecord
	{
	public:
	  ModelColumnsTAB()
	  {
		add(m_col_active);
		add(m_col_type);
		add(m_col_id);
		add(m_col_elements);
		add(m_col_description);
	  }
	  Gtk::TreeModelColumn<Glib::ustring> m_col_active;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_type;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_id;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_elements;
	  Gtk::TreeModelColumn<Glib::ustring> m_col_description;
	};
	const ModelColumnsTAB m_columns;



--__--__--

Message: 11
Date: Thu, 15 Apr 2004 23:48:45 +0200
From: "Andreas B. Thun" <abt gmx de>
To: bart <gtkmm hakvoort be>, gtkmm-list <gtkmm-list gnome org>
Subject: Re: [gtkmm] Treeview help needed

You have to connect some callbacks indeed. take a look at
Gtk::TreeViewColumn::signal_clicked()


Maybe you can help me the last time before I go to bed:
(you were of great help, anyway)

What is my Gtk::TreeViewColumn?

m_tree_view.m_columns.m_col_active is not correct ...



	// Tree model columns:
 	class ModelColumnsTAB : public Gtk::TreeModel::ColumnRecord
 	{
 	public:
 	  ModelColumnsTAB()
 	  {
 		add(m_col_active);
 		add(m_col_type);
 		add(m_col_id);
 		add(m_col_elements);
 		add(m_col_description);
 	  }
 	  Gtk::TreeModelColumn<Glib::ustring> m_col_active;
 	  Gtk::TreeModelColumn<Glib::ustring> m_col_type;
 	  Gtk::TreeModelColumn<Glib::ustring> m_col_id;
 	  Gtk::TreeModelColumn<Glib::ustring> m_col_elements;
 	  Gtk::TreeModelColumn<Glib::ustring> m_col_description;
 	};
 	const ModelColumnsTAB m_columns;


--__--__--

Message: 12
Date: Fri, 16 Apr 2004 01:10:15 +0200
From: Christer Palm <palm nogui se>
To: bart <gtkmm hakvoort be>
Cc: "Andreas B. Thun" <abt gmx de>, gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed

bart wrote:
This always works for me, but if i'm not mistaken Christer mentioned
another way of accomplishing this. So i'd like to hear more ;-)


Basically, this is the code I'm using (now, I use libglademm, so my TreeView has already been created by libglade):

--------------------------------------------------

struct MyColumnrec : public Gtk::TreeModel::ColumnRecord {
    Gtk::TreeModelColumn<Glib::ustring> col1;
    MyColumnrec() { add(col1); }
} myColumnrec;

Glib::RefPtr<Gtk::ListStore> myModel =
    Gtk::ListStore::create(myColumnrec);

myTreeview->set_model(myModel);

Gtk::TreeViewColumn* col1 = Gtk::manage(
    new Gtk::TreeViewColumn("Col1"), myColumnrec.col1);
col1->set_sort_column_id(myColumnrec.col1);
myTreeview->append_column(*col1);

--------------------------------------------------

That's it. Just set_sort_column_id() and it should work. At least it works super for me for a bunch of TreeViews...

--
Christer


--__--__--

Message: 13
Date: Fri, 16 Apr 2004 00:15:16 +0200
From: "Andreas B. Thun" <abt gmx de>
To: bart <gtkmm hakvoort be>
Cc: gtkmm-list gnome org
Subject: Re: [gtkmm] Treeview help needed

You have to connect some callbacks indeed. take a look at
Gtk::TreeViewColumn::signal_clicked()

Finally, I found out how to connect a callback:

  TreeViewColumn* col0 = m_tree_view.get_column(0);
  col0->signal_clicked().connect(slot(*this, &ConstraintTable::onFirstColHeaderClicked));


Thx *very* much Bart!



--__--__--

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


End of gtkmm-list Digest





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