[gtkada] How can I make a GtkAda text cell renderer editable?

Michael Gonzalez mgh at unican.es
Thu Oct 14 15:54:32 CEST 2010


Dear Dmitry:

Thank you very much for your answer. However, I still have one question. 
I understand that the solution that you mention works after the cell has 
been edited, by catching the "edited" signal. However, in my case I 
cannot edit the cell. I would expect to find something like a text entry 
in each cell, where I can type in some text, but what I get is 
unmodifiable text.

So, how can I make cells where I can type in some text?

Thanks,

Michael González.

On 10/14/2010 03:18 PM, Dmitry A. Kazakov wrote:
> On Thu, 14 Oct 2010 14:01:05 +0200, you wrote:
>
>> I am trying to make a table with editable data using a Tree_View and an
>> associated Tree_Store. I am using a Gtk_Cell_Renderer_Text for all the
>> columns.
>>
>> I set the Editable mode with:
>>
>>    Set_Property(My_Text_Renderer,ModeProperty,Cell_Renderer_Mode_Editable)
>>
>> If I read the property with Get_Property it has the desired value.
>>
>> According to the reference manual, if you set this mode the renderer
>> should allow the user to edit the contents. However, my text columns are
>> not editable.
>>
>> Is there something else that I need to do? How can I make the text
>> columns editable? Can you give me a pointer to some example?
>
> Maybe this: a cell renderer does not change the model. It only creates an
> editable widget upon its activation. Upon editing completion the widget
> sends a signal to the renderer and that is it. So you want to commit the
> changes made in that transient widget.
>
> Specifically to the Gtk_Cell_Renderer_Text, you should catch the signal
> "edited" and then put the new text into the model [you can also reject the
> text in a more advanced UI, color it, etc].
>
> The "edited" signal carries the model path with it, from which you can get
> the iterator to the cell where to set the text into. (There is a call to
> restore the iterator from a path string.) Note that this is only a path, so
> if you have several editable cells per row, you should also do something in
> order to detect which cell has been edited. E.g. you may use different
> instances of Gtk_Cell_Renderer_Text, one per column etc.
>



More information about the gtkada mailing list