[gtkada] gtk_list

Preben Randhol randhol at pvv.org
Sun Jan 13 19:36:35 CET 2002


"Clark, G L" <g.l.clark at lmco.com> wrote on 11/01/2002 (00:07) :
> 
> 
>   I'm looking for a good clear example of how to get the value of a gtk_list
> member when selected.

use gtk_clist instead and connect the callbacks like this:

----------------------------------------------------------

      Widget_Callback.Connect (Gui_List.List_Clist,
             "select_row",
            Callbacks.On_Row_Selected'Access);

      Widget_Callback.Connect (Gui_List.List_Clist,
             "unselect_row",
            Callbacks.On_Row_Unselected'Access);

----------------------------------------------------------

in the Callbacks package (I usually make a child package)

--...

   use Gtk.Arguments;

   procedure On_Row_Selected
     (Object : access Gtk_Widget_Record'Class; Params : Gtk_Args ) is

      Row    : Gint := To_Gint (Params, 1);
      Column : Gint := To_Gint (Params, 2);
      Event  : Gdk_Event := To_Event (Params, 3);
   begin

      if (Row >= 0) then
      -- Do your stuff here.
      end if;

   end On_Row_Selected;


   procedure On_Row_Unselected
     (Object : access Gtk_Widget_Record'Class; Params : Gtk_Args ) is
   begin
      -- Do your stuff here.
   end On_Row_Unselected;


-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 «For me, Ada95 puts back the joy in programming.»




More information about the gtkada mailing list