[gtkada] Signal handler
Dmitry A. Kazakov
mailbox at dmitry-kazakov.de
Fri Jun 10 18:57:38 CEST 2011
On Fri, 10 Jun 2011 16:01:19 +0200, you wrote:
> In package Gtk.Entry_Completion:
> -- - "match_selected"
> -- procedure Handler
> -- (Completion : access Gtk_Entry_Completion_Record'Class;
> -- Model : Gtk_Tree_Model;
> -- Iter : Gtk_Tree_Iter);
> -- Gets emitted when a match from the list is selected. The default
> -- behaviour is to replace the contents of the entry with the contents of
> -- the text column in the row pointed to by Iter.
> -- Return value: %TRUE if the signal has been handled
>
> How can I instantiate a package from Gtk.Handlers to connect this handler?
You instantiate Gtk.Handlers.User_Callback or Gtk.Handlers.Callback as
usual. Then you declare handler as follows:
procedure Entry_Completion_Handler
( Object : access Gtk_Entry_Completion_Record'Class;
Params : GValues
);
Within the handler you access parameters as follows:
procedure Entry_Completion_Handler
( Object : access Gtk_Entry_Completion_Record'Class;
Params : GValues
) is
Iter : Gtk_Tree_Iter;
begin
Get_Tree_Iter (Nth (Params, 1), Iter);
See Gtk.Tree_Model.Get_Tree_Iter. Getting the model is a bit more
complicated, but models are normally accessible implicitly through other
ways. If you still want to get it from GValue use GLib.Values.Get_Object on
Nth (Params, 0).
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
More information about the gtkada
mailing list