comp.lang.ada
 help / color / mirror / Atom feed
From: John Perry <devotus@yahoo.com>
Subject: GtkAda's "On_Edited"
Date: Sun, 29 May 2022 22:28:41 -0700 (PDT)	[thread overview]
Message-ID: <fa06c2df-0b2b-4ddc-9534-b025df4d3f76n@googlegroups.com> (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

             reply	other threads:[~2022-05-30  5:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  5:28 John Perry [this message]
2022-05-30  6:47 ` GtkAda's "On_Edited" 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
replies disabled

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