[gtkada] simple gtk_editable question

Clark, G L g.l.clark at lmco.com
Wed Jan 9 20:16:52 CET 2002


 Thanks, that makes a lot of sense... but I still can't get it to work.

  I need to maintain the original code base which defines NAME as the
subtype NAME_TYPE and NAME_TYPE as a string of (1..40)...  could it have
something to do with the use of subtypes?   To simplify things for testing
purposes I removed all that and now have a simple bounded string called
holder which I'm trying to get the value from the entry. I'm still getting a
constraint error raised on the 'get_chars' line.  I know I know, probably a
simple Ada problem...  Anybody?

      -George Clark

--------------------
  holder : string(1..40);

   procedure On_Create_Database_Accept_Button_Clicked
     (Object : access Gtk_Button_Record'Class)
   is
   begin
     
      holder := get_chars(Create_Database_D.New_Database_Entry)(1..40);
   --...
   end;
-----------------------

-----Original Message-----
From: Michal Nowikowski [mailto:godfryd at zamek.gda.pl]
Sent: Wednesday, January 09, 2002 2:46 AM
To: gtkada at lists.act-europe.fr
Subject: Re: [gtkada] simple gtk_editable question


              You "Clark, G L" <g.l.clark at lmco.com> who had written:

>  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);

because get_chars(Create_Database_Dialog.New_Database_Entry) can return 
another amount of chars than 40

You could do sth like this

declare
   name : String := get_chars(Create_Database_Dialog.New_Database_Entry);
begin
   ...
end;

or

FORM_DATA.NAME :=
get_chars(Create_Database_Dialog.New_Database_Entry)(1..40);

Godfryd

-- 
|  Michal Nowikowski <godfryd at zamek.gda.pl>
|  wymówka admina #268:
|  Neutrino overload on the nameserver

_______________________________________________
gtkada mailing list
gtkada at lists.act-europe.fr
http://lists.act-europe.fr/mailman/listinfo/gtkada




More information about the gtkada mailing list