Re: How to make a single cell editable in Gtk::TreeView?



On Tue, 2012-03-06 at 22:28 +0100, Gerardo Ballabio wrote:
> 2012/3/6, Kjell Ahlstedt <kjell ahlstedt bredband net>:
> > I haven't tested this, but I think you shall call one of the
> > Gtk::TreeView::set_cursor() methods with start_editing = true.
> 
> That worked after I specialized on_expose_event() and put the call
> there. Putting it in the constructor didn't work, even after
> show_all_children(): the row was selected, but the cell wasn't open
> for editing. I suppose between the constructor and the expose
> something happens that turns off editing mode.

Maybe you were doing this in some other TreeView signal handler. I've
had similar problems, which I've solved by using a signal_idle handler.
connect_once() makes this fairly easy:
http://developer.gnome.org/glibmm/unstable/classGlib_1_1SignalTimeout.html#a4ea8fdd120102d7963709916f28b2bcc

I think it makes more sense to use this than an expose handler. I think
it's a common technique.

> I've reattached your example with my modifications (marked by //!!!).
> Note that I had to make a couple of other changes (change Box to VBox
> and ButtonBox to HButtonBox) because I'm using gtkmm 2.4 (what is
> available on Debian stable).


-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



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