[gtkada] Glade and selecting the right widget

Preben Randhol randhol at pvv.org
Fri Jan 11 15:13:47 CET 2002


Frode Tennebø <frode at tennebo.com> wrote on 11/01/2002 (00:06) :
> After some Deep Though® I have started implementing my application.
> This is my first Gtk(Ada) appliation and am having ambigious
> experiences compared to Motif. :) Again, it more of an Gtk+ issue, but
> I hope you can bear with me.

I have no experience with Motif, but the nice thing with GtkAda is that
you don't put things in fixed positions, so use hbox and vbox to do what
you want.

> Currently I'm designing the interface using Glade, and though it is
> pretty basic I have a wish I'm not entirely sure how to implement. I'm
> want a hpane divided in two where one of them is a vertical list of say
> up to 10 elements of a composit widget with three widgets; a pushb, an
> optionm and a textf.
> The user starts with one entry in the list and can add more using a
> separate pushb. The user can then remove an entry pushing the pushb
> belonging to that entry. This interface is for selecting various
> criterias for searching in a database. The optionm selects the key
> while the textf is the search text.
> 
> I asume that I have to put the three widgets which I am reusing into a
> window, but how can I add properties to the instances so that they are
> 'unique'? Or do I need to do that at all?

I don't quite understand what you mean by unique, but if you want these
repeated then make a new composit widget from either a frame or a vbox
with what you need and then just use Gtk_New to make a new widget and
Add the widget to a vbox.

   type Gui_Search_Widget_Record is new Gtk_Frame_Record with 
      record
         Remove_Button        : Gtk_Button;
         Key_Options          : Gtk_Option_Menu;
         Search_Entry         : Gtk_Gentry;
      end record;

   type Gui_Search_Widget_Access is access all Gui_Search_Widget_Record'Class;

   procedure Gtk_New (Widget : out Gui_Search_Widget_Access);
   procedure Initialize (Gui_Setup : access Gui_Search_Widget_Record'Class);

To implement Gtk_New and Initialize look at the source code glade gives.

> I'm thinking of using a vbox as a container - should I set it up with a
> fixed size (ie. no. of boxes) or is it better to have it dynamically
> resize?

No. You just make a vbox and then you add as many items you like into it.

Could you perhaps make a screenshot of what this looks like in Glade as
it is hard to understand from the text description.

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




More information about the gtkada mailing list