[gtkada] gtk_list

Clark, G L g.l.clark at lmco.com
Thu Jan 10 22:11:10 CET 2002


  I'm looking for a good clear example of how to get the value of a gtk_list
member when selected.

I've searched the documentation... and scoured the examples included with
the Gtk install but found no good help.   gtktest has a good list usage
example but leaves out retrieving the value.

I have a callback generated from glade...:

  procedure On_Database_Name_List_Select_Child
     (Object : access Gtk_List_Record'Class;
     Params : Gtk.Arguments.Gtk_Args)
  is
     Arg1 : Gtk_Widget := Gtk_Widget (To_Object (Params, 1));
  begin

      -- here I would actually like to see what was selected but I have no
idea how!!
      -- and for some reason the gtkada reference leaves out gtk_list

  end On_Database_Name_List_Select_Child;

  Thanks.
      George Clark

-----Original Message-----
From: Eric Mathieu [mailto:eric.mathieu at c-s-canada.ca]
Sent: Wednesday, January 09, 2002 1:37 PM
To: gtkada at lists.act-europe.fr
Subject: RE: [gtkada] simple gtk_editable question



May be you can try this:  

	name : name_type;

procedure On_Create_Database_Accept_Button_Clicked
      (Object : access Gtk_Button_Record'Class)
   is
     holder : constant string :=
get_chars(Create_Database_D.New_Database_Entry);
    begin
       if holder'length > name'length then
	name(1..40) := holder(holder'first .. holder'first + 39);
       else
	name := (others => ' ');
     	name(1 .. holder'length) := holder(holder'first .. holder'last);
      end if;
      --...
    end;
 -----------------------

Eric Mathieu


> -----Original Message-----
> From: gtkada-admin at lists.act-europe.fr 
> [mailto:gtkada-admin at lists.act-europe.fr]On Behalf Of Clark, G L
> Sent: 9 janvier 2002 14:17
> To: 'gtkada at lists.act-europe.fr'
> Subject: RE: [gtkada] simple gtk_editable question
> 
> 
> 
>  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
> 
> _______________________________________________
> gtkada mailing list
> gtkada at lists.act-europe.fr
> http://lists.act-europe.fr/mailman/listinfo/gtkada
> 

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




More information about the gtkada mailing list