[gtkada] Question about Item_Factory and constraint error

Chip Richards chipr at niestu.com
Mon Feb 19 08:00:43 CET 2001


On Sun, Feb 18, 2001 at 04:16:22PM +0100, Arnaud Charlet wrote:

> No problem. We spent quite a bit of time writing the doc, so this is where
> people should look to answer their questions/problems.

I understand about the time it takes to write documentation.  I do it myself,
sometimes better, sometimes worse.  I *had* looked in the docs before I wrote
to the list; it hadn't occurred to me before your message that what I was
converting was actually a "C widget".

> However maintaining a doc up-to-date is also lots of work and error prone.
> In this case, Uncheck_Cast has been removed from GtkAda ...

Understood, thanks for the clarification.  So, based on your comment below
about unchecked conversions not working, does that mean that the only
"approved" way to use implicitly-created widgets is to include in your app the
"with Gtk.Type_Conversion" clause?

> If you notice other discrepencies or thing that are not lcear in the
> documentation, do not hesitate to report it ...

Count on it.

> > 2. My original question ... was: Why does the conversion work in testgtk
> > and not in my code?
>
> You are missing the next subsection in the documentation (The solution
> we...)

Actually, what I was missing was the "with Gtk.Type_Conversion" in the testgtk
code.  It's not in tesgtk.adb, nor is it in create_item_factory.adb, nor two
or three other "likely" places I looked.  But it *is* there (it's in
create_sheet.adb, for reasons that no doubt made perfect sense at the time),
and that explains the difference in behavior between testgtk and my app.
Again, I thank you.

Although oddly enough, I do not find a call to "Gtk.Type_Conversion.Init"
anywhere in testgtk.  Is that another inconsistency in the docs?  Or was it
sufficient for the needs of testgtk to do the "with" and not call Init?

> Unchecked conversions won't work.

Ouch.  Using Ada.Unchecked_Conversion worked fine for me in this case.  What
sort of failure am I setting myself up for by using it?

-- 
Chip




More information about the gtkada mailing list