[gtkada] simple gtk_editable question

Emmanuel Briot briot at ACT-Europe.FR
Wed Jan 9 09:45:14 CET 2002


"Clark, G L" <g.l.clark at lmco.com> writes:

>   I'm getting a Constraint error when trying to read the characters from an
> editable field into a bounded string.
> 
> ------------------------------
> subtype NAME_TYPE is string(1..40);
> ...
> --(Name is of type NAME_TYPE)
> FORM_DATA.NAME := get_chars(Create_Database_Dialog.New_Database_Entry);
> -------------------------------


This is indeed a general Ada question :-)
This would only work if the string you are reading from the entry field has
exactly 40 characters. The trick is to do the following:

declare
   Name_Type : constant String :=
      Get_Chars (Create_Database_Dialog.New_Database_Entry);
begin
   ...;
end;


Emmanuel




More information about the gtkada mailing list