comp.lang.ada
 help / color / mirror / Atom feed
From: Emmanuel Briot <briot@act-europe.fr>
Subject: Re: Getting started with GtkAda & Glade
Date: Wed, 05 Sep 2001 08:43:25 GMT
Date: 2001-09-05T08:43:25+00:00	[thread overview]
Message-ID: <m3ae0a112s.fsf@lyon.act-europe.fr> (raw)
In-Reply-To: e7ebd224.0109031047.20c61253@posting.google.com

karlran1234@yahoo.com (Karl Ran) writes:
> I played a little bit with your suggestions but I haven't found a
> solution for
> for my problem ... due to my lack of Ada/Gtk knowledge., I guess
> 
> Ok, now the code looks like this:
> 
> -----------------------------------------------------------------------
>    function On_Hscale1_Motion_Notify_Event
>      (Object : access Gtk_Widget_Record'Class;
>       Params : Gtk.Arguments.Gtk_Args) return Boolean
>    is
>       Arg1  : Gdk_Event := To_Event (Params, 1);
>       Scale : Gtk_Scale := Gtk_Scale (Object);  
>    begin
>      Put_Line ("Current_Value is " & Gdouble'Image (Get_Value
> (Scale)));
>      return False;
>    end On_Hscale1_Motion_Notify_Event;
> ------------------------------------------------------------------------


Sorry,
I now realize I had looked at the development version of gtk+/GtkAda.
Instead, you would do something like:

  Put_Line (Gdouble'Image (Get_Value (Get_Adjustment (Scale))));

It does seem complex, however this is because the set of possible values for a
lot of widgets in gtk+ are separated from the value they contain. Instead, that
value is stored in a structure called a Gtk_Adjustment (that contains the
current value, the minimum and maximum possible values and a few other
fields). The nice thing is that other widgets can ask to receive signals when
the value is changed (Pretty close to the standard Model-View-Controller model,
I believe).

The new version of gtk+/GtkAda has more direct access functions, even though
they do the same thing as above in the background.

Emmanuel




      reply	other threads:[~2001-09-05  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-31 12:37 Getting started with GtkAda & Glade Karl Ran
2001-09-03  7:48 ` Emmanuel Briot
2001-09-03 18:47   ` Karl Ran
2001-09-05  8:43     ` Emmanuel Briot [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox