comp.lang.ada
 help / color / mirror / Atom feed
* gtkada and timeouts
@ 2011-04-01  8:09 tonyg
  2011-04-01  8:27 ` Dmitry A. Kazakov
  2011-04-01  8:50 ` Julian Leyh
  0 siblings, 2 replies; 7+ messages in thread
From: tonyg @ 2011-04-01  8:09 UTC (permalink / raw)



I've written a function called update_screen which always returns a
value of true and sets various values in the 'main_screen' access
record. This is part of the code from glade/gate which I have modified
to include a timeout

with Gtk; use Gtk;
with Gtk; use Gtk;
with Gtk.Main; use Gtk.Main;
with Gtk.Widget; use Gtk.Widget;
with Main_Screen_Pkg; use Main_Screen_Pkg;
with Main_Control; use Main_Control;
procedure Main_Screen is
   Main_Screen : Main_Screen_Access;
        Timeout_Id : Timeout_Handler_id ;
   package Data_Timeout is new Gtk.Main.Timeout (Main_Screen_Access);

begin
   Gtk.Main.Set_Locale;
   Gtk.Main.Init;
   Gtk_New (Main_Screen);
   Show_All (Main_Screen);
   Gtk.Main.Main;
   -- my addition -- the timer
   Timeout_Id := Data_Timeout.Add (100, Update_Screen'Access,
Main_Screen);

end Main_Screen;

Sadly the timeout is never called, Can anyone cast some light on this?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-01  8:09 gtkada and timeouts tonyg
@ 2011-04-01  8:27 ` Dmitry A. Kazakov
  2011-04-01  9:15   ` tonyg
  2011-04-01  8:50 ` Julian Leyh
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry A. Kazakov @ 2011-04-01  8:27 UTC (permalink / raw)


On Fri, 1 Apr 2011 01:09:36 -0700 (PDT), tonyg wrote:

> I've written a function called update_screen which always returns a
> value of true and sets various values in the 'main_screen' access
> record. This is part of the code from glade/gate which I have modified
> to include a timeout
> 
> with Gtk; use Gtk;
> with Gtk; use Gtk;
> with Gtk.Main; use Gtk.Main;
> with Gtk.Widget; use Gtk.Widget;
> with Main_Screen_Pkg; use Main_Screen_Pkg;
> with Main_Control; use Main_Control;
> procedure Main_Screen is
>    Main_Screen : Main_Screen_Access;
>         Timeout_Id : Timeout_Handler_id ;
>    package Data_Timeout is new Gtk.Main.Timeout (Main_Screen_Access);
> 
> begin
>    Gtk.Main.Set_Locale;
>    Gtk.Main.Init;
>    Gtk_New (Main_Screen);
>    Show_All (Main_Screen);
>    Gtk.Main.Main;
>    -- my addition -- the timer
>    Timeout_Id := Data_Timeout.Add (100, Update_Screen'Access,
> Main_Screen);
> 
> end Main_Screen;
> 
> Sadly the timeout is never called, Can anyone cast some light on this?

The procedure Gtk.Main.Main runs infinite messages loop. You should add
timers before entering the loop.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-01  8:09 gtkada and timeouts tonyg
  2011-04-01  8:27 ` Dmitry A. Kazakov
@ 2011-04-01  8:50 ` Julian Leyh
  2011-04-02  1:37   ` Randy Brukardt
  1 sibling, 1 reply; 7+ messages in thread
From: Julian Leyh @ 2011-04-01  8:50 UTC (permalink / raw)


On 1 Apr., 10:09, tonyg <tonytheg...@gmail.com> wrote:
> I've written a function called update_screen which always returns a
> value of true and sets various values in the 'main_screen' access
> record. This is part of the code from glade/gate which I have modified
> to include a timeout
>
> with Gtk; use Gtk;
> with Gtk; use Gtk;
> with Gtk.Main; use Gtk.Main;
> with Gtk.Widget; use Gtk.Widget;
> with Main_Screen_Pkg; use Main_Screen_Pkg;
> with Main_Control; use Main_Control;
> procedure Main_Screen is
>    Main_Screen : Main_Screen_Access;
>         Timeout_Id : Timeout_Handler_id ;
>    package Data_Timeout is new Gtk.Main.Timeout (Main_Screen_Access);
>
> begin
>    Gtk.Main.Set_Locale;
>    Gtk.Main.Init;
>    Gtk_New (Main_Screen);
>    Show_All (Main_Screen);
>    Gtk.Main.Main;
>    -- my addition -- the timer
>    Timeout_Id := Data_Timeout.Add (100, Update_Screen'Access,
> Main_Screen);
>
> end Main_Screen;
>
> Sadly the timeout is never called, Can anyone cast some light on this?

Gtk.Main.Main never returns.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-01  8:27 ` Dmitry A. Kazakov
@ 2011-04-01  9:15   ` tonyg
  2011-04-01  9:53     ` tonyg
  0 siblings, 1 reply; 7+ messages in thread
From: tonyg @ 2011-04-01  9:15 UTC (permalink / raw)


On Apr 1, 9:27 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Fri, 1 Apr 2011 01:09:36 -0700 (PDT), tonyg wrote:
> > I've written a function called update_screen which always returns a
> > value of true and sets various values in the 'main_screen' access
> > record. This is part of the code from glade/gate which I have modified
> > to include a timeout
>
> > with Gtk; use Gtk;
> > with Gtk; use Gtk;
> > with Gtk.Main; use Gtk.Main;
> > with Gtk.Widget; use Gtk.Widget;
> > with Main_Screen_Pkg; use Main_Screen_Pkg;
> > with Main_Control; use Main_Control;
> > procedure Main_Screen is
> >    Main_Screen : Main_Screen_Access;
> >         Timeout_Id : Timeout_Handler_id ;
> >    package Data_Timeout is new Gtk.Main.Timeout (Main_Screen_Access);
>
> > begin
> >    Gtk.Main.Set_Locale;
> >    Gtk.Main.Init;
> >    Gtk_New (Main_Screen);
> >    Show_All (Main_Screen);
> >    Gtk.Main.Main;
> >    -- my addition -- the timer
> >    Timeout_Id := Data_Timeout.Add (100, Update_Screen'Access,
> > Main_Screen);
>
> > end Main_Screen;
>
> > Sadly the timeout is never called, Can anyone cast some light on this?
>
> The procedure Gtk.Main.Main runs infinite messages loop. You should add
> timers before entering the loop.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

I tried placing it just before the Gtk.Main.Main and the whole app
locked up. I'm going to put it now in the initialise procedure than
gate creates in the _pkg.adb.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-01  9:15   ` tonyg
@ 2011-04-01  9:53     ` tonyg
  0 siblings, 0 replies; 7+ messages in thread
From: tonyg @ 2011-04-01  9:53 UTC (permalink / raw)


On Apr 1, 10:15 am, tonyg <tonytheg...@gmail.com> wrote:
> On Apr 1, 9:27 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>
>
>
> > On Fri, 1 Apr 2011 01:09:36 -0700 (PDT), tonyg wrote:
> > > I've written a function called update_screen which always returns a
> > > value of true and sets various values in the 'main_screen' access
> > > record. This is part of the code from glade/gate which I have modified
> > > to include a timeout
>
> > > with Gtk; use Gtk;
> > > with Gtk; use Gtk;
> > > with Gtk.Main; use Gtk.Main;
> > > with Gtk.Widget; use Gtk.Widget;
> > > with Main_Screen_Pkg; use Main_Screen_Pkg;
> > > with Main_Control; use Main_Control;
> > > procedure Main_Screen is
> > >    Main_Screen : Main_Screen_Access;
> > >         Timeout_Id : Timeout_Handler_id ;
> > >    package Data_Timeout is new Gtk.Main.Timeout (Main_Screen_Access);
>
> > > begin
> > >    Gtk.Main.Set_Locale;
> > >    Gtk.Main.Init;
> > >    Gtk_New (Main_Screen);
> > >    Show_All (Main_Screen);
> > >    Gtk.Main.Main;
> > >    -- my addition -- the timer
> > >    Timeout_Id := Data_Timeout.Add (100, Update_Screen'Access,
> > > Main_Screen);
>
> > > end Main_Screen;
>
> > > Sadly the timeout is never called, Can anyone cast some light on this?
>
> > The procedure Gtk.Main.Main runs infinite messages loop. You should add
> > timers before entering the loop.
>
> > --
> > Regards,
> > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
>
> I tried placing it just before the Gtk.Main.Main and the whole app
> locked up. I'm going to put it now in the initialise procedure than
> gate creates in the _pkg.adb.

Thanks Guys, that bits working now and I have moved on to my next self
inflicted bug ! :)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-01  8:50 ` Julian Leyh
@ 2011-04-02  1:37   ` Randy Brukardt
  2011-04-02  8:21     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Brukardt @ 2011-04-02  1:37 UTC (permalink / raw)


"Julian Leyh" <julian@vgai.de> wrote in message 
news:ed10b192-03d8-49f7-9beb-613458681d7a@e8g2000vbz.googlegroups.com...
...
>Gtk.Main.Main never returns.

Never? Does it have a pragma No_Return? Any non-returning routine should 
have that pragma. I believe that GNAT would have given the OP a warning 
about never executed code if any follows a No_Return routine. (And if it 
doesn't, it should.)

                               Randy.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: gtkada and timeouts
  2011-04-02  1:37   ` Randy Brukardt
@ 2011-04-02  8:21     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry A. Kazakov @ 2011-04-02  8:21 UTC (permalink / raw)


On Fri, 1 Apr 2011 20:37:12 -0500, Randy Brukardt wrote:

> "Julian Leyh" <julian@vgai.de> wrote in message 
> news:ed10b192-03d8-49f7-9beb-613458681d7a@e8g2000vbz.googlegroups.com...
> ...
>>Gtk.Main.Main never returns.
> 
> Never?

It does when the window gets closed. 

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-04-02  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-01  8:09 gtkada and timeouts tonyg
2011-04-01  8:27 ` Dmitry A. Kazakov
2011-04-01  9:15   ` tonyg
2011-04-01  9:53     ` tonyg
2011-04-01  8:50 ` Julian Leyh
2011-04-02  1:37   ` Randy Brukardt
2011-04-02  8:21     ` Dmitry A. Kazakov

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