[gtkada] Signal handler
Emmanuel Briot
briot at adacore.com
Fri Jun 10 18:45:29 CEST 2011
> 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 should instantiate Gtk.Handlers.Callback as usual.
GtkAda does not have a Marshaller for this profile (ie a function that converts
from the C level GValues into (Model, Iter)), so you have to use, as a callback,
a procedure with the following profile (from Gtk.Handlers.Callback)
type Handler is access procedure
(Widget : access Widget_Type'Class;
Params : Glib.Values.GValues);
and then extract the arguments from Params yourself.
Model := Get_Object (Nth (Params, 0)); -- ??? Perhaps 1, not sure
Gtk.Tree_Model.Get_Tree_Iter (Nth (Params, 1), Iter);
I haven't tested this, so you might have to adapt a bit to get it to work.
regards
Emmanuel
More information about the gtkada
mailing list