comp.lang.ada
 help / color / mirror / Atom feed
* GtkAda's "On_Edited"
@ 2022-05-30  5:28 John Perry
  2022-05-30  6:47 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 5+ messages in thread
From: John Perry @ 2022-05-30  5:28 UTC (permalink / raw)


I'm trying to edit a cell in a Tree_View with a List_Store, and saw in GtkAda's User Guide that it offers the On_Edited procedure. I set up a callback this way with the following procedure:

   procedure Editing_Done
      ( Self    : access Gtk_Cell_Renderer_Text_Record'Class;
        Path     : Glib.UTF8_String; -- this is the row
        New_Text : Glib.UTF8_String
       ) is
   begin
      Tio.Put_Line( Get_Property(Self, Gtk.Cell_Renderer_Text.Text_Property)'Image ); -- line 1
      Tio.Put_Line(Path'Image); -- line 2
      Tio.Put_Line(New_Text'Image); -- line 3
      Set_Property(Self, Gtk.Cell_Renderer_Text.Text_Property, New_Text);
      Self.Stop_Editing( False );
      Tio.Put_Line( Get_Property(Self, Gtk.Cell_Renderer_Text.Text_Property)'Image ); -- line 4
   end Editing_Done;

I didn't really expect this to work, and it doesn't, but here's what I have verified it does do, in order:

* prints the data that was in the cell before editing (line 1)
* prints the row that was edited (line 2)
* prints the new text (line 3)
* prints the data that is in the cell as the procedure ends (line 4)

Lines 3 and 4 agree, which is great! But what I see in the TreeView is that the cell reverts after editing to the value in Line 1.

My questions:

1) The documentation of On_Edited states that I am supposed to "update the model and store New_Text at the position indicated by Path." How do I get the model? I understand that "Path" indicates the row in the List_Store / TreeView, but Get_Model's Signature requires a TreeView, which I do not have.

2) What else might I be missing from a correct implementation of the On_Edited callback?

thanks in advance
john perry

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-01  3:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30  5:28 GtkAda's "On_Edited" John Perry
2022-05-30  6:47 ` Dmitry A. Kazakov
2022-05-30  7:46   ` John Perry
2022-05-30 18:57     ` Dmitry A. Kazakov
2022-06-01  3:18       ` John Perry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox