Re: using TreeView::set_cursor in a function connected to CellRendererText::signal_edited



2013-07-03 07:59, Kjell Ahlstedt skrev:
2013-06-30 20:40, Jonas Platte skrev:
Hello,

I'm having a little problem with editable cells: I have a validity check for data entered into a editable cell, and if it fails, I want to give the user another try to enter something into that same cell.

To get the focus to the previously edited cell again after showing an error message, I use TreeView::set_cursor with the last parameter start_editing set to true (while in the signal handler for signal_edited of the cell renderer).

The problem is that, when confirming the input by clicking somewhere outside the cell, the UI gets messed up: the entry for the edited cell is there as it should (and its content is reset as it should), but can't be confirmed or aborted anymore. I get the following error message on the command line:

Gtk-CRITICAL **: gtk_container_remove: assertion 'gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container)' failed

Is it just not allowed to use set_cursor while handling the confirmation of editing a cell or is this a bug I should file?


I can confirm that the same thing happens with one of the example programs in the gtkmm tutorial,
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/treeview/editable_cells

If the input in the cell is finish by pressing Enter, no critical message is printed. If the input in the cell is finish by moving to another cell, the critical message is printed.
It looks like a bug, but I don't know if it's a gtkmm bug or a gtk+ bug.

Kjell

I made some changes to the gtk+ test gtk+/tests/testtreeedit.c. A pure gtk+ application shows the same bad behaviour as a gtkmm application.
If you file a bug (or have already done so), make it a gtk+ bug.

It may not be trivial to fix. If it can't be fixed, it should at least be documented that gtk_tree_view_set_cursor() and gtk_tree_view_set_cursor_on_cell() (and thus Gtk::TreeView::set_cursor()) can't be used in a GtkCellRendererText's edited signal handler.

Kjell


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