Re: [gtkmm] how do I know when a row has been edited?
- From: "Andreas B. Thun" <abt gmx de>
- To: Roger Leigh <roger whinlatter uklinux net>
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: [gtkmm] how do I know when a row has been edited?
- Date: Tue, 06 Apr 2004 19:12:32 +0200
Hi Roger,
Thx for your reply. I am slightly irritated now.
Seems very complicated. I just cannot apply
your solution to my code :-(
Is it not possible to connect a callback to a
row directly?
Gtk::TreeModel::iterator iter = m_listStoreRef->append();
ROW row = *iter;
row[m_columns.m_elementType] = "myType";
row[m_columns.m_elementId] = "myData";
// dumb try, won't work
row->signal_row_changed().connect(SigC::slot (*this,
&MyTable::rowChangedCallback));
Roger Leigh schrieb:
>
> "Andreas B. Thun" <abt gmx de> writes:
>
> > How can I call a callback when a value in my list has been changed?
> > signal_changed() only calls my callback after selection but not when
> > I edit the row.
> >
> > I read about signal_row_changed() but I don't have a TreeModel...
>
> If you have an editable cell:
>
> treeview->set_model(tree_store);
> int view_column = treeview->append_column("Name", list_columns.m_col_name);
> Gtk::CellRenderer *renderer =
> treeview->get_column_cell_renderer(view_column - 1);
> Gtk::CellRendererText *text_renderer =
> dynamic_cast<Gtk::CellRendererText *>(renderer);
> if (text_renderer)
> {
> text_renderer->property_editable() = true;
> text_renderer->signal_edited().connect
> ( SigC::slot(*this, &MyDialog::on_edited) );
> }
>
> void
> MyDialog::on_edited(const Glib::ustring& path,
> const Glib::ustring& text)
> {
> // Check if the value has changed from its previous value...
> {
> Gtk::TreeModel::iterator cur =
> m_tree_store->get_iter(Gtk::TreePath(path));
> Gtk::TreeModel::Row row = *cur;
> if (row[list_columns.m_col_name] == text) // value is unchanged
> return;
> }
>
> // Do other stuff here...
> }
>
> HTH,
> Roger
>
> --
> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]