[gtkada] Question about Item_Factory and constraint error

Arnaud Charlet charlet at ACT-Europe.FR
Sun Feb 18 16:16:22 CET 2001


> Okay, that's interesting info.  I assume you are talking about the text under
> the heading "Type conversions from C to Ada widgets" in the section
> "Object-oriented features".  Your referral was very useful, thanks!

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

> But it raises a new question, and leaves my main original question unanswered:
> 
> 1. It says "you will thus have to do an Uncheck_Cast to convert it back to the
> type you want".  What is "Uncheck_Cast"?  Is it intending to refer to
> Ada.Unchecked_Conversion?  Of *course* I could have done the type conversion
> using this facility, but I wanted to understand why the error was occurring
> before I just ignored it.  Heck, if I wanted to program that way, I'd just use
> C. <grin>

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 and the doc has not
been updated. We will either update the doc or put back Uncheck_Cast in the
next version of GtkAda, thanks for noticing it.

If you notice other discrepencies or thing that are not lcear in the
documentation, do not hesitate to report it, we are trying to make the doc as
complete and understandable as possible.

> 2. My original question, which was probably obscured by the length of my
> original explanation, was: Why does the conversion work in testgtk and not in
> my code?  It's not like Create_Item and Create_Items are substantively
> different on the Ada side--they're both just pass-throughs to the C code.  And
> the C code for the array version just makes multiple calls to the singleton
> version.

You are missing the next subsection in the documentation (The solution we...)

> There's apparently some other difference that I'm not seeing.  I can certainly
> make my code work as expected, with the somewhat unpleasant addition of an
> unchecked conversion.  But I still don't understand the whole picture.

Unchecked conversions won't work.

Arno




More information about the gtkada mailing list