[gtkada] Select_Row signal in Clist

Preben Randhol randhol at pvv.org
Tue Nov 20 11:33:10 CET 2001


Emmanuel Briot <briot at ACT-Europe.FR> wrote on 20/11/2001 (11:15) :
> 
> Note that a Marshaller is basically simply a function that splits this array
> into a number of separate parameters and then call your callback, so there is
> no difference in safety.

OK I see. Thanks.

> We'll enhance the GtkAda user's guide to add a little bit more information
> about this, since indeed it is lacking...

Very nice! The part with Signals can be somewhat confusing. It would be
nice if there was some common examples on how to do things.

One tip is that the "activate" of a GEntry can be used to get the text
when the user hits Return/Enter.

One that I found very tricky is radio-buttons. I don't know if I have
done it very difficult as I made a Enumerated type in my setup package:


   type Method_Enum_Type is (Spell, MChoice); 

and this callback package:

   package Method_Callback is new
         Gtk.Handlers.User_Callback (Gtk_Radio_Button_Record,
                                     Method_Enum_Type);

and hooked the R_Buttons like this:

   Callbacks.Method_Callback.Connect
       (Gui_Setup.Spelling_R_Button, "toggled",
        Callbacks.Method_Callback.To_Marshaller
          (Callbacks.On_Method_Radio_Button_Toggle'Access),
           Spell);

            -- Next R_Button with MChoice

to this procedure:

   procedure On_Method_Radio_Button_Toggle
      (Object : access  Gtk_Radio_Button_Record'Class;
       Method : Method_Enum_Type) is
   begin
      if Get_Active (Object) = True then 
         Setup.Examine_Method := Method;
      end if;
   end On_Method_Radio_Button_Toggle;

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

Preben who just reduced the size of his program executable with 50k
(10%) after realizing that it was stupid to do:

   package Button_Callback is new
         Gtk.Handlers.Callback (Gtk_Button_Record);

in every callback child package for the different widgets and moved it
into one callback package for the whole program.

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




More information about the gtkada mailing list