Re: GtkCellRenderer: start editing with an initial value



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.
> > gtk_treeview_set_cursor_on_cell() can start the editing, but first it
> > puts the data from the tree model in the CellRenderer.
> > 
> > I want to do this in my GtkCellRendererText::edited signal handler so
> > that I can ask the user to edit the text again until it passes
> > validation. I'd like the user to start the second editing with the bad
> > text from the first edit, without ever putting the bad text in the
> > model.
> > 
> > I tried doing some of what gtk_treeview_set_cursor_on_cell() does,
> > including the strange cell_background, and cell_area stuff, but I'm not
> > sure what to pass for the widget parameter of
> > gtk_cell_renderer_start_editing():
> > http://developer.gnome.org/doc/API/2.0/gtk/GtkCellRenderer.html#gtk-
> > cell-renderer-start-editing
> > 
> > gtk_treeview_set_cursor_on_cell() seems to eventually get that widget
> > from the private gtk_tree_view_column_cell_process_action() function,
> > but I'm lost there.
> > 
> 
> 
> You can use the GtkCellRenderer::editing-started signal which was
> introduced exactly to allow such setup to happen on the editable.

Thanks

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.
?

That's not working for me so far, but I haven't tried it in a simple
test case.

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