Re: GtkCellRenderer: start editing with an initial value



On Thu, 2005-02-17 at 21:04 +0100, Murray Cumming wrote:
> On Thu, 2005-02-17 at 14:21 -0500, Matthias Clasen wrote:
> > On Thu, 2005-02-17 at 19:56 +0100, Murray Cumming wrote:
> > > Is there any way to make a GtkCellRendererText start editing, while also
> > > specifying what text it should start with.
[snip]
> > You can use the GtkCellRenderer::editing-started signal which was
> > introduced exactly to allow such setup to happen on the editable.
> 
> So, I should be able to just
> - handle the GtkCellRenderer::editing-started signal and store the
> GtkCellEditable* that it gives me.
> - call gtk_cell_editable_start_editing(celleditable, 0) from my
> GtkCellRendererText::edited signal handler, to restart editing.
> ?

gtk_cell_editable_start_editing() does not seem to do anything in this
case. But I think I had things backwards anyway.

I am now doing this:
- In my GtkCellRendererText::edited signal handler, store the invalid
inputed text and set a retry boolean, then call gtk_tree_view_set_cursor
() with start_editing = true.
- In my GtkCellRenderer::editing_started signal, if the retry boolean is
set, then cast the GtkCellEditable to GtkEntry and set its text to the 
previously-stored value. 

For the record, this is shown, with gtkmm, in the last 2 methods here:
http://cvs.gnome.org/viewcvs/gtkmm/examples/book/treeview/editable_cells/examplewindow.cc?view=markup

I'm still not sure whether it's a good idea to start editing from inside
a GtkCellRendererText::edited signal handler, though.

-- 
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]