From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3af4bf9fdc8875b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-31 05:37:31 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: karlran1234@yahoo.com (Karl Ran) Newsgroups: comp.lang.ada Subject: Getting started with GtkAda & Glade Date: 31 Aug 2001 05:37:31 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 62.104.223.81 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 999261451 12506 127.0.0.1 (31 Aug 2001 12:37:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 31 Aug 2001 12:37:31 GMT Xref: archiver1.google.com comp.lang.ada:12604 Date: 2001-08-31T12:37:31+00:00 List-Id: Hi there, I'm trying to created a GUI with GtkAda and Glade(the RAD tool). It's just one window with one horizontal scale widget (Class GtkHScale); Glade create this file (window1_pkg-callbacks.adb) for me: ----------------------------------------------------------------- with System; use System; with Glib; use Glib; with Gdk.Event; use Gdk.Event; with Gdk.Types; use Gdk.Types; with Gtk.Accel_Group; use Gtk.Accel_Group; with Gtk.Object; use Gtk.Object; with Gtk.Enums; use Gtk.Enums; with Gtk.Style; use Gtk.Style; with Gtk.Widget; use Gtk.Widget; with Ada.Text_IO; package body Window1_Pkg.Callbacks is use Gtk.Arguments; ------------------------------------ -- On_Hscale1_Motion_Notify_Event -- ------------------------------------ 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); begin Ada.Text_IO.Put_Line("Well, the user moved the slider but I don't know the position :("); return False; end On_Hscale1_Motion_Notify_Event; end Window1_Pkg.Callbacks; ----------------------------------------------------------------- What I like to accomplish is to print the current value(position) of the slider while the user is moving it. Anyone know what have to be placed inside the Put_Line-brackets? Karl PS: This is the XML Glade source... Menu2 menu2 src pixmaps Ada 95 False True GtkWindow window1 window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False False True False GtkHScale hscale1 True motion_notify_event on_hscale1_motion_notify_event Fri, 31 Aug 2001 12:16:08 GMT True GTK_POS_TOP 1 GTK_UPDATE_CONTINUOUS 0 1 42 1 0 0 From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3af4bf9fdc8875b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-03 00:48:05 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!oleane.net!oleane!proxad.net!feeder2-1.proxad.net!nnrp4.proxad.net.POSTED!not-for-mail Sender: briot@lyon.act-europe.fr Newsgroups: comp.lang.ada Subject: Re: Getting started with GtkAda & Glade References: From: Emmanuel Briot Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.103 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 03 Sep 2001 07:48:04 GMT NNTP-Posting-Host: 213.228.58.160 X-Complaints-To: abuse@proxad.net X-Trace: nnrp4.proxad.net 999503284 213.228.58.160 (Mon, 03 Sep 2001 09:48:04 CEST) NNTP-Posting-Date: Mon, 03 Sep 2001 09:48:04 CEST Organization: Guest of ProXad - France Xref: archiver1.google.com comp.lang.ada:12647 Date: 2001-09-03T07:48:04+00:00 List-Id: karlran1234@yahoo.com (Karl Ran) writes: > Hi there, > > I'm trying to created a GUI with GtkAda and Glade(the RAD tool). > It's just one window with one horizontal scale widget (Class > GtkHScale); > Glade create this file (window1_pkg-callbacks.adb) for me: [...] > ----------------------------------------------------------------- > > What I like to accomplish is to print the current value(position) of > the slider > while the user is moving it. Yes, try something like: declare Scale : Gtk_Scale := Gtk_Scale (Object); begin Put_Line ("Current_Value is " & Gdouble'Image (Get_Value (Scale))); end; Emmanuel From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3af4bf9fdc8875b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-03 11:47:19 PST Path: archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mail From: karlran1234@yahoo.com (Karl Ran) Newsgroups: comp.lang.ada Subject: Re: Getting started with GtkAda & Glade Date: 3 Sep 2001 11:47:18 -0700 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 62.104.214.87 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 999542839 5640 127.0.0.1 (3 Sep 2001 18:47:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 3 Sep 2001 18:47:19 GMT Xref: archiver1.google.com comp.lang.ada:12667 Date: 2001-09-03T18:47:19+00:00 List-Id: Hi Emmanuel, >Yes, try something like: declare > Scale : Gtk_Scale := Gtk_Scale (Object); > begin > Put_Line ("Current_Value is " > & Gdouble'Image (Get_Value (Scale))); > end; 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; ------------------------------------------------------------------------ Now I get this message: gcc -c -gnatf -I/usr/local/include/gtkada window1_pkg-callbacks.adb window1_pkg-callbacks.adb:27:64: expected type access to "Gtk_Adjustment_Record" defined at gtk-adjustment.ads:97 window1_pkg-callbacks.adb:27:64: found type "Gtk_Scale" defined at gtk-scale.ads:40 window1_pkg-callbacks.adb:27:64: ==> in call to "Get_Value" at gtk-adjustment.ads:97 gnatmake: "window1_pkg-callbacks.adb" compilation error Any help would be appreciated.. Karl From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3af4bf9fdc8875b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-05 01:43:25 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp1.proxad.net.POSTED!not-for-mail Sender: briot@lyon.act-europe.fr Newsgroups: comp.lang.ada Subject: Re: Getting started with GtkAda & Glade References: From: Emmanuel Briot Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.105 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 05 Sep 2001 08:43:25 GMT NNTP-Posting-Host: 213.228.58.160 X-Complaints-To: abuse@proxad.net X-Trace: nnrp1.proxad.net 999679405 213.228.58.160 (Wed, 05 Sep 2001 10:43:25 CEST) NNTP-Posting-Date: Wed, 05 Sep 2001 10:43:25 CEST Organization: Guest of ProXad - France Xref: archiver1.google.com comp.lang.ada:12736 Date: 2001-09-05T08:43:25+00:00 List-Id: 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