[gtkada] Help needed creating custom gtkada widget

Brent Seidel brentseidel at mac.com
Thu Jan 14 15:12:51 CET 2016


The widget now displays properly.  It turns out that instead of overriding any or all of the following:
   overriding procedure Get_Preferred_Height
      (self         : not null access bbs_dial_record;
       Minimum_Height : out Glib.Gint;
       Natural_Height : out Glib.Gint);

   overriding procedure Get_Preferred_Height_For_Width
      (self         : not null access bbs_dial_record;
       Width          : Glib.Gint;
       Minimum_Height : out Glib.Gint;
       Natural_Height : out Glib.Gint);

   overriding procedure Get_Preferred_Size
      (self       : not null access bbs_dial_record;
       Minimum_Size : out Gtk.Widget.Gtk_Requisition;
       Natural_Size : out Gtk.Widget.Gtk_Requisition);

   overriding procedure Get_Preferred_Width
      (self        : not null access bbs_dial_record;
       Minimum_Width : out Glib.Gint;
       Natural_Width : out Glib.Gint);

   overriding procedure Get_Preferred_Width_For_Height
      (self        : not null access bbs_dial_record;
       Height        : Glib.Gint;
       Minimum_Width : out Glib.Gint;
       Natural_Width : out Glib.Gint);

   overriding procedure Get_Size_Request
      (self : not null access bbs_dial_record;
       Width  : out Glib.Gint;
       Height : out Glib.Gint);

to communicate the widget size, one has to set properties:
      Glib.Properties.Set_Property(self, Gtk.Widget.Height_Request_Property, 200);
      Glib.Properties.Set_Property(self, Gtk.Widget.Width_Request_Property, 200);

I’m not sure that this is the proper way to do things, but it seems to work.

brent

> On Jan 12, 2016, at 8:52 AM, Brent Seidel <brentseidel at mac.com> wrote:
> 
> Thanks Dmitry,
> 
> It now runs and I get a message from the put_line in the draw routine so I know that it’s getting properly called.  After some googliing, I discovered that you can add “—gtk-debug all” on the command line and get a bunch of information.  Saving it to a file and searching for “bbs_dial” suggests that the widget size is getting set to 0x0.  I think that I am getting closer to figuring this out…
> 
> thanks,
> brent
> 



More information about the gtkada mailing list