GTK+ 2.0 Tree View Tutorial | ||
---|---|---|
<<< Previous | Chapter 8. Editable Cells | Next >>> |
Even though GtkSpinButton implements the GtkCellEditable interface (as does GtkEntry), there is no easy way to get a cell renderer that uses a spin button instead of a normal entry when in editing mode.
To get this functionality, you need to either write a new cell renderer that works very similar to GtkCellRendererText, or you need to write a new cell renderer class that derives from the text cell renderer and changes the behaviour in editing mode.
The cleanest solution would probably be to write a 'CellRendererNumeric' that does everything that the text cell renderer does, only that it has a float type property instead of the "text" property, and an additional digits property. However, no one seems to have done this yet, so you need to either write one, or find another solution to get spin buttons in editing mode.
Among this tutorial's code examples there is a hackish CellRendererSpin implementation which is based on GtkCellRendererText and shows spin buttons in editing mode. The implementation is not very refined though, so you need to make sure it works in your particular context, and modify it as needed.
<<< Previous | Home | Next >>> |
Editable Toggle and Radio Button Cells | Up | Miscellaneous |