[gtkada] Dynamically Changing the Toggle Button Label

Morris Dare adaos_md at hotmail.com
Fri Oct 13 02:20:18 CEST 2000


After reading the docs again, I did miss the need for the line
   Gtk.Type_Conversion.Init;

My fault for that.

With that in place and trying it again I still get the constraint error when 
I make the following call.

I tried this way:

   Gtk.Label.Set_Text
     (Gtk.Label.Gtk_Label
        (Gtk.Toggle_Button.Get_Child (Window1.Togglebutton1)),
          "label");

and this way:
   Window1.Label2 :=
     Gtk.Label.Gtk_Label (Gtk.Toggle_Button.
                            Get_Child (Togglebutton1));

      Gtk.Label.Set_Text (Window1.Label2, "label");

Both ways give the constraint error.

Does the fact I am using 1.3.8 on NT4.0 and/or Win98 have any bearing.

I created a simple version using Glade that contains a single toplevel 
window with 2 cell vbox that contains a toggle button in one cell and a 
simple label in the other. I am using only the toggled signal to change the 
second label as a test which does work but the call to change the label in 
the toggle button causes a constraint error.

FYI: I've doing Ada for quite a while but this is my first venture into GUI 
work. Sorry for being such a pain.

Another FYI: The best reason I could think of for a set_text or set_label 
procedure for the button line would be for simplicity of use.

Thanks again for the help it is greatly appreciated.

Morris Dare

>From: Arnaud Charlet <charlet at ACT-Europe.FR>
>Reply-To: gtkada at gtkada.eu.org
>To: gtkada at gtkada.eu.org
>Subject: Re: [gtkada] Dynamically Changing the Toggle Button Label
>Date: Thu, 12 Oct 2000 17:46:06 +0200
>
> > I tried the above, it compiles but when I execute it I get a Contraint 
>Error
> > at the Set_Text Line.
>
>Emmanuel explained that with GtkAda 1.2.8, you do need Gtk.Type_Conversion.
>
> > Maybe I did something wrong, I don't know. When I withed in
> > Gtk.Type_Conversion the compiler said no entities from it were being 
>used.
>
>It sounds like you didn't read the GtkAda documentation, nor the
>GNAT documentation for that matter ;-)
>
>What the compiler said was a warning, not an error, what you forgot to do
>is to call Gtk.Type_Conversion.Init, I am not sure how the GtkAda 
>documentation
>could make it clearer (any suggestion is welcome btw):
>
><<
>@example
>@b{with} Gtk.Type_Conversion;
>
>@b{begin}
>    Gtk.Main.Init;
>    Gtk.Type_Conversion.Init;
>    ...
>@b{end}
>@end example
> >>
>
> > Also, when will there be a set_text procedure that takes a button and 
>text
> > entry to directly set the text on a button.
>
>I fail to see the necessity of such a procedure when it is as simple
>as Set_Text (Gtk_Label (Get_Child (Button)), "label").
>
>Note that if you are developping with GtkAda for a serious project, you
>might find useful to buy support from Ada Core Technologies or ACT Europe,
>depending on your geographic location.
>
>Best,
>
>Arno
>
>_______________________________________________
>gtkada mailing list
>gtkada at gtkada.eu.org
>http://gtkada.eu.org/mailman/listinfo/gtkada

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.





More information about the gtkada mailing list