[gtkada] Dynamically Changing the Toggle Button Label

Morris Dare adaos_md at hotmail.com
Thu Oct 12 16:38:39 CEST 2000


>  >From: Morris Dare <adaos_md at hotmail.com>
>  > > I want to know if there is a way to change the Label on a toggle 
>button
>  > > dynamically during program execution. I have tried everything that 
>looks
>  > > likely to me but to no avail.

>From: Emmanuel Briot <briot at gnat.com>
>
>This is of course doable :-)
>As you can notice in the documentation, a button (and thus a toggle_button) 
>is
>a container. As documented, it can contain anything from a label (default), 
>to
>a pixmap,...
>Thus, the trick here is to do the following:
>
>    declare
>       Toggle       : Gtk_Toggle_Button := <....>;
>       Button_Label : Gtk_Label;
>    begin
>       Button_Label := Gtk_Label (Get_Child (Toggle));
>       Set_Text (Button_Label, "whatever");
>    end;
>
>
>Note that the cast to Gtk_Label above requires that you
>    with Gtk.Type_Conversion;
>with GtkAda 1.2.8, although it is no longer required in the upcoming 
>version.
>Please check the documentation (user guide) for this package.
>
>Emmanuel

I tried the above, it compiles but when I execute it I get a Contraint Error 
at the Set_Text Line.

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.

Any suggestions on this!

Also, when will there be a set_text procedure that takes a button and text 
entry to directly set the text on a button.

Thanks for all the help so far!

Morris Dare
Contract Software Engineer

_________________________________________________________________________
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