Re: treeview Tab control
- From: "Thomas Sommer" <mawa15 gmx de>
- To: gtkmm-list gnome org
- Subject: Re: treeview Tab control
- Date: Wed, 04 Nov 2009 18:06:25 +0100
That's exactly what I tried before:
bool gui::key_pressed(GdkEventKey* event)
{
if(event->type == GDK_KEY_PRESS && event->keyval == GDK_Tab)
{
Gtk::TreeModel::iterator iter =
m_refTreeSelection_TreeView->get_selected();
Gtk::TreeModel::Path p;
Gtk::TreeViewColumn* c;
m_pTreeView->get_cursor(p,c);
if(c==m_pTreeView_OPL->get_column(0))
m_pTreeView_OPL->
set_cursor(m_refModel_TreeView->get_path(iter),
*(m_pTreeView->get_column(1)),true);
}
return true;
}
Problem is:
Hittin tab will set the cursors to the second column but the entry in
the editable gets lost. Restoring it to the value stored in the TreeStore.
Therefore I tried to get a hold of the cellrenderer
Gtk::CellRenderer* r=m_pTreeView->get_column_cell_renderer (0);
Gtk::CellRendererText* t=dynamic_cast<Gtk::CellRendererText*>(r);
and tried to emit the changed signal. Sadly the emit() funktion does not exist ;-(
t->signal_edited().emit();
I know this is a bad idea but doing something like this would be much easier than writing my own cellrenderer (I think).
I read something about calling the signal handler instead of emitting the signal myself. But how do I call the signal handler of the celleditable?
Thanks,
Thomas
-------- Original-Nachricht --------
> Datum: Mon, 2 Nov 2009 14:35:36 +0600
> Von: "Галымжан Кожаев" <kozhayev gmail com>
> An: "José Alburquerque" <jaalburquerque cox net>
> CC: Thomas Sommer <mawa15 gmx de>, gtkmm-list gnome org
> Betreff: Re: treeview Tab control
> Hi, Thomas.
> Maybe you should try to catch GDK events ? Like this:
>
> // in constructor
> signal_key_press_event().connect(sigc::mem_fun(*this,
> &MyTreeView::onKeyPressEvent), false);
>
> /// .............
> bool MyTreeView::onKeyPressEvent(GdkEventKey* event) {
> if(event->type == GDK_KEY_PRESS) {
> if(event->keyval == GDK_Return) {
> // set active next column
> // ...
> // and stop executing of other handlers
> return true;
> }
> }
> return false;
> }
>
> If your gdk event handler returns true, all other handlers won't be
> executed. GDK_Return represents "Enter" key, you should replace it
> with GDK_Tab (but i'm not sure, look at gtkmm header files).
>
> Galymzhan.
>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]