[gtkada] bad mapping for Get(Gtk.Label)?
Preben Randhol
randhol at pvv.org
Thu Mar 9 09:35:49 CET 2000
Jake Hamby <jehamby at anobject.com> wrote on 09/03/2000 (09:12) :
> Anyway, having said that, I'm not an Ada 95 guru (yet!), but the mapping
> for Get(Gtk.Label) looks less than useful. As far as I can tell, you need
> to know in advance the length of String to allocate for it. In fact, if
> I try to use a String which is too small, I get a CONSTRAINT_ERROR at
> runtime. A version which returns Unbounded_String, or a procedure version
> something like Text_IO.Get_Line(s: out String; len: out Natural), would
> make a lot more sense to me. Thanks!
Have you tried:
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
-- [...]
type My_String : Unbounded_String;
-- [...]
begin
-- [...]
My_String := To_Unbounbed_String(Get(Gtk.Label));
-- [...]
end;
PS: I don't have an Ada 95 compiler on this machine yet (not enough disc
space), so I haven't checked this code.
--
Preben Randhol -- [randhol at pvv.org] -- [http://www.pvv.org/~randhol/]
"Det eneste trygge stedet i verden er inne i en fortelling."
-- Athol Fugard
More information about the gtkada
mailing list